gebpy 1.1.3__py3-none-any.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 (254) hide show
  1. gebpy/__init__.py +55 -0
  2. gebpy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. gebpy/adapters/__init__.py +0 -0
  4. gebpy/cli/__init__.py +0 -0
  5. gebpy/core/__init__.py +0 -0
  6. gebpy/core/chemistry/__init__.py +0 -0
  7. gebpy/core/chemistry/common.py +1369 -0
  8. gebpy/core/chemistry/elements.py +317 -0
  9. gebpy/core/chemistry/geochemistry.py +1728 -0
  10. gebpy/core/fluids/__init__.py +0 -0
  11. gebpy/core/io/__init__.py +0 -0
  12. gebpy/core/mathematics/__init__.py +0 -0
  13. gebpy/core/minerals/__init__.py +0 -0
  14. gebpy/core/minerals/carbonates.py +412 -0
  15. gebpy/core/minerals/common.py +555 -0
  16. gebpy/core/minerals/config.py +77 -0
  17. gebpy/core/minerals/cyclosilicates.py +0 -0
  18. gebpy/core/minerals/halides.py +0 -0
  19. gebpy/core/minerals/inosilicates.py +0 -0
  20. gebpy/core/minerals/nesosilicates.py +0 -0
  21. gebpy/core/minerals/organics.py +0 -0
  22. gebpy/core/minerals/oxides.py +589 -0
  23. gebpy/core/minerals/phosphates.py +0 -0
  24. gebpy/core/minerals/phospides.py +0 -0
  25. gebpy/core/minerals/phyllosilicates.py +436 -0
  26. gebpy/core/minerals/sorosilicates.py +0 -0
  27. gebpy/core/minerals/sulfates.py +0 -0
  28. gebpy/core/minerals/sulfides.py +459 -0
  29. gebpy/core/minerals/synthesis.py +201 -0
  30. gebpy/core/minerals/tectosilicates.py +433 -0
  31. gebpy/core/physics/__init__.py +0 -0
  32. gebpy/core/physics/common.py +53 -0
  33. gebpy/core/physics/geophysics.py +351 -0
  34. gebpy/core/rocks/__init__.py +0 -0
  35. gebpy/core/rocks/anisotropic_rocks.py +395 -0
  36. gebpy/core/rocks/common.py +95 -0
  37. gebpy/core/rocks/config.py +77 -0
  38. gebpy/core/rocks/isotropic_rocks.py +395 -0
  39. gebpy/core/rocks/sedimentary.py +385 -0
  40. gebpy/core/subsurface/__init__.py +0 -0
  41. gebpy/data_minerals/__init__.py +0 -0
  42. gebpy/data_minerals/albite.yaml +59 -0
  43. gebpy/data_minerals/anatase.yaml +43 -0
  44. gebpy/data_minerals/ankerite.yaml +47 -0
  45. gebpy/data_minerals/annite.yaml +57 -0
  46. gebpy/data_minerals/anorthite.yaml +59 -0
  47. gebpy/data_minerals/antigorite.yaml +53 -0
  48. gebpy/data_minerals/aragonite.yaml +48 -0
  49. gebpy/data_minerals/argutite.yaml +43 -0
  50. gebpy/data_minerals/arsenolite.yaml +40 -0
  51. gebpy/data_minerals/au3oxide.yaml +46 -0
  52. gebpy/data_minerals/avicennite.yaml +40 -0
  53. gebpy/data_minerals/azurite.yaml +53 -0
  54. gebpy/data_minerals/baddeleyite.yaml +49 -0
  55. gebpy/data_minerals/bismite.yaml +49 -0
  56. gebpy/data_minerals/boehmite.yaml +48 -0
  57. gebpy/data_minerals/brookite.yaml +46 -0
  58. gebpy/data_minerals/brucite.yaml +45 -0
  59. gebpy/data_minerals/bunsenite.yaml +40 -0
  60. gebpy/data_minerals/calcite.yaml +45 -0
  61. gebpy/data_minerals/cassiterite.yaml +43 -0
  62. gebpy/data_minerals/cerussite.yaml +48 -0
  63. gebpy/data_minerals/chamosite.yaml +56 -0
  64. gebpy/data_minerals/chlorite.yaml +75 -0
  65. gebpy/data_minerals/chromite.yaml +42 -0
  66. gebpy/data_minerals/chrysotile.yaml +53 -0
  67. gebpy/data_minerals/claudetite.yaml +49 -0
  68. gebpy/data_minerals/clinochlore.yaml +55 -0
  69. gebpy/data_minerals/cochromite.yaml +42 -0
  70. gebpy/data_minerals/corundum.yaml +43 -0
  71. gebpy/data_minerals/crocoite.yaml +51 -0
  72. gebpy/data_minerals/cuprite.yaml +40 -0
  73. gebpy/data_minerals/cuprospinel.yaml +42 -0
  74. gebpy/data_minerals/diaspore.yaml +48 -0
  75. gebpy/data_minerals/dolomite.yaml +47 -0
  76. gebpy/data_minerals/eastonite.yaml +57 -0
  77. gebpy/data_minerals/eskolaite.yaml +43 -0
  78. gebpy/data_minerals/fechlorite.yaml +61 -0
  79. gebpy/data_minerals/fecolumbite.yaml +48 -0
  80. gebpy/data_minerals/ferberite.yaml +51 -0
  81. gebpy/data_minerals/fetantalite.yaml +48 -0
  82. gebpy/data_minerals/franklinite.yaml +42 -0
  83. gebpy/data_minerals/gahnite.yaml +42 -0
  84. gebpy/data_minerals/galaxite.yaml +42 -0
  85. gebpy/data_minerals/geikielite.yaml +45 -0
  86. gebpy/data_minerals/gibbsite.yaml +51 -0
  87. gebpy/data_minerals/glauconite.yaml +69 -0
  88. gebpy/data_minerals/goethite.yaml +48 -0
  89. gebpy/data_minerals/groutite.yaml +48 -0
  90. gebpy/data_minerals/hematite.yaml +43 -0
  91. gebpy/data_minerals/hercynite.yaml +42 -0
  92. gebpy/data_minerals/huebnerite.yaml +51 -0
  93. gebpy/data_minerals/ikaite.yaml +53 -0
  94. gebpy/data_minerals/illite.yaml +55 -0
  95. gebpy/data_minerals/ilmenite.yaml +45 -0
  96. gebpy/data_minerals/jacobsite.yaml +42 -0
  97. gebpy/data_minerals/kalsilite.yaml +47 -0
  98. gebpy/data_minerals/kaolinite.yaml +59 -0
  99. gebpy/data_minerals/karelianite.yaml +43 -0
  100. gebpy/data_minerals/lime.yaml +40 -0
  101. gebpy/data_minerals/litharge.yaml +43 -0
  102. gebpy/data_minerals/magnesiochromite.yaml +42 -0
  103. gebpy/data_minerals/magnesioferrite.yaml +42 -0
  104. gebpy/data_minerals/magnesite.yaml +45 -0
  105. gebpy/data_minerals/magnetite.yaml +41 -0
  106. gebpy/data_minerals/malachite.yaml +53 -0
  107. gebpy/data_minerals/manganite.yaml +51 -0
  108. gebpy/data_minerals/manganochromite.yaml +42 -0
  109. gebpy/data_minerals/manganosite.yaml +40 -0
  110. gebpy/data_minerals/marialite.yaml +49 -0
  111. gebpy/data_minerals/massicot.yaml +46 -0
  112. gebpy/data_minerals/meionite.yaml +49 -0
  113. gebpy/data_minerals/mgchlorite.yaml +61 -0
  114. gebpy/data_minerals/mgcolumbite.yaml +48 -0
  115. gebpy/data_minerals/mgtantalite.yaml +48 -0
  116. gebpy/data_minerals/microcline.yaml +59 -0
  117. gebpy/data_minerals/minium.yaml +44 -0
  118. gebpy/data_minerals/mnchlorite.yaml +61 -0
  119. gebpy/data_minerals/mncolumbite.yaml +48 -0
  120. gebpy/data_minerals/mntantalite.yaml +48 -0
  121. gebpy/data_minerals/monteponite.yaml +40 -0
  122. gebpy/data_minerals/montmorillonite.yaml +77 -0
  123. gebpy/data_minerals/muscovite.yaml +55 -0
  124. gebpy/data_minerals/nanepheline.yaml +47 -0
  125. gebpy/data_minerals/nichlorite.yaml +61 -0
  126. gebpy/data_minerals/nichromite.yaml +42 -0
  127. gebpy/data_minerals/nimite.yaml +55 -0
  128. gebpy/data_minerals/nontronite.yaml +73 -0
  129. gebpy/data_minerals/orthoclase.yaml +53 -0
  130. gebpy/data_minerals/paratellurite.yaml +43 -0
  131. gebpy/data_minerals/pennantite.yaml +61 -0
  132. gebpy/data_minerals/periclase.yaml +40 -0
  133. gebpy/data_minerals/phlogopite.yaml +57 -0
  134. gebpy/data_minerals/plattnerite.yaml +43 -0
  135. gebpy/data_minerals/powellite.yaml +45 -0
  136. gebpy/data_minerals/pyrite.yaml +40 -0
  137. gebpy/data_minerals/pyrolusite.yaml +43 -0
  138. gebpy/data_minerals/pyrophanite.yaml +45 -0
  139. gebpy/data_minerals/pyrophyllite.yaml +59 -0
  140. gebpy/data_minerals/quartz.yaml +43 -0
  141. gebpy/data_minerals/rhodochrosite.yaml +45 -0
  142. gebpy/data_minerals/rutile.yaml +43 -0
  143. gebpy/data_minerals/saponite.yaml +77 -0
  144. gebpy/data_minerals/scheelite.yaml +45 -0
  145. gebpy/data_minerals/scrutinyite.yaml +46 -0
  146. gebpy/data_minerals/senarmontite.yaml +40 -0
  147. gebpy/data_minerals/siderite.yaml +45 -0
  148. gebpy/data_minerals/siderophyllite.yaml +57 -0
  149. gebpy/data_minerals/smithsonite.yaml +45 -0
  150. gebpy/data_minerals/spinel.yaml +42 -0
  151. gebpy/data_minerals/stishovite.yaml +43 -0
  152. gebpy/data_minerals/stolzite.yaml +45 -0
  153. gebpy/data_minerals/talc.yaml +53 -0
  154. gebpy/data_minerals/tistarite.yaml +43 -0
  155. gebpy/data_minerals/trevorite.yaml +42 -0
  156. gebpy/data_minerals/ulvoespinel.yaml +42 -0
  157. gebpy/data_minerals/uraninite.yaml +40 -0
  158. gebpy/data_minerals/valentinite.yaml +46 -0
  159. gebpy/data_minerals/vermiculite.yaml +69 -0
  160. gebpy/data_minerals/wulfenite.yaml +45 -0
  161. gebpy/data_minerals/wustite.yaml +40 -0
  162. gebpy/data_minerals/zincite.yaml +43 -0
  163. gebpy/data_minerals/zincochromite.yaml +42 -0
  164. gebpy/data_rocks/__init__.py +0 -0
  165. gebpy/data_rocks/dolostone.yaml +40 -0
  166. gebpy/data_rocks/limestone.yaml +40 -0
  167. gebpy/data_rocks/marl.yaml +50 -0
  168. gebpy/data_rocks/sandstone.yaml +39 -0
  169. gebpy/data_rocks/shale.yaml +50 -0
  170. gebpy/gebpy_app.py +8732 -0
  171. gebpy/gui/__init__.py +0 -0
  172. gebpy/lib/images/GebPy_Header.png +0 -0
  173. gebpy/lib/images/GebPy_Icon.png +0 -0
  174. gebpy/lib/images/GebPy_Logo.png +0 -0
  175. gebpy/main.py +29 -0
  176. gebpy/modules/__init__.py +0 -0
  177. gebpy/modules/__pycache__/__init__.cpython-310.pyc +0 -0
  178. gebpy/modules/__pycache__/metamorphics.cpython-310.pyc +0 -0
  179. gebpy/modules/__pycache__/silicates.cpython-310.pyc +0 -0
  180. gebpy/modules/carbonates.py +2658 -0
  181. gebpy/modules/chemistry.py +1369 -0
  182. gebpy/modules/core.py +1805 -0
  183. gebpy/modules/elements.py +317 -0
  184. gebpy/modules/evaporites.py +1299 -0
  185. gebpy/modules/exploration.py +1145 -0
  186. gebpy/modules/fluids.py +339 -0
  187. gebpy/modules/geochemistry.py +1727 -0
  188. gebpy/modules/geophysics.py +351 -0
  189. gebpy/modules/gui.py +9093 -0
  190. gebpy/modules/gui_elements.py +145 -0
  191. gebpy/modules/halides.py +485 -0
  192. gebpy/modules/igneous.py +2241 -0
  193. gebpy/modules/metamorphics.py +3222 -0
  194. gebpy/modules/mineralogy.py +442 -0
  195. gebpy/modules/minerals.py +7954 -0
  196. gebpy/modules/ore.py +1648 -0
  197. gebpy/modules/organics.py +530 -0
  198. gebpy/modules/oxides.py +9057 -0
  199. gebpy/modules/petrophysics.py +98 -0
  200. gebpy/modules/phosphates.py +589 -0
  201. gebpy/modules/phospides.py +194 -0
  202. gebpy/modules/plotting.py +619 -0
  203. gebpy/modules/pyllosilicates.py +380 -0
  204. gebpy/modules/sedimentary_rocks.py +908 -0
  205. gebpy/modules/sequences.py +2166 -0
  206. gebpy/modules/series.py +1625 -0
  207. gebpy/modules/silicates.py +11102 -0
  208. gebpy/modules/siliciclastics.py +1846 -0
  209. gebpy/modules/subsurface_2d.py +179 -0
  210. gebpy/modules/sulfates.py +1629 -0
  211. gebpy/modules/sulfides.py +4786 -0
  212. gebpy/plotting/__init__.py +0 -0
  213. gebpy/ui_nb/__init__.py +0 -0
  214. gebpy/user_data/.gitkeep +0 -0
  215. gebpy-1.1.3.dist-info/LICENSE +165 -0
  216. gebpy-1.1.3.dist-info/METADATA +207 -0
  217. gebpy-1.1.3.dist-info/RECORD +254 -0
  218. gebpy-1.1.3.dist-info/WHEEL +5 -0
  219. gebpy-1.1.3.dist-info/entry_points.txt +2 -0
  220. gebpy-1.1.3.dist-info/top_level.txt +1 -0
  221. modules/__init__.py +0 -0
  222. modules/carbonates.py +2658 -0
  223. modules/chemistry.py +1369 -0
  224. modules/core.py +1805 -0
  225. modules/elements.py +317 -0
  226. modules/evaporites.py +1299 -0
  227. modules/exploration.py +765 -0
  228. modules/fluids.py +339 -0
  229. modules/geochemistry.py +1727 -0
  230. modules/geophysics.py +337 -0
  231. modules/gui.py +9093 -0
  232. modules/gui_elements.py +145 -0
  233. modules/halides.py +485 -0
  234. modules/igneous.py +2196 -0
  235. modules/metamorphics.py +2699 -0
  236. modules/mineralogy.py +442 -0
  237. modules/minerals.py +7954 -0
  238. modules/ore.py +1628 -0
  239. modules/organics.py +530 -0
  240. modules/oxides.py +9057 -0
  241. modules/petrophysics.py +98 -0
  242. modules/phosphates.py +589 -0
  243. modules/phospides.py +194 -0
  244. modules/plotting.py +619 -0
  245. modules/pyllosilicates.py +380 -0
  246. modules/sedimentary_rocks.py +908 -0
  247. modules/sequences.py +2166 -0
  248. modules/series.py +1625 -0
  249. modules/silicates.py +11102 -0
  250. modules/siliciclastics.py +1830 -0
  251. modules/subsurface_2d.py +179 -0
  252. modules/sulfates.py +1629 -0
  253. modules/sulfides.py +4786 -0
  254. notebooks/__init__.py +0 -0
@@ -0,0 +1,3222 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ # -----------------------------------------------
5
+
6
+ # Name: metamorphics.py
7
+ # Author: Maximilian A. Beeskow
8
+ # Version: 1.0
9
+ # Date: 20.12.2024
10
+
11
+ # -----------------------------------------------
12
+
13
+ ## MODULES
14
+ import numpy as np
15
+ import random as rd
16
+ # internal
17
+ try:
18
+ from gebpy.modules.chemistry import PeriodicSystem, OxideCompounds
19
+ from gebpy.modules.oxides import Oxides
20
+ from gebpy.modules.carbonates import Carbonates
21
+ from gebpy.modules.silicates import Tectosilicates, Nesosilicates, Sorosilicates, Phyllosilicates, Inosilicates
22
+ from gebpy.modules.phosphates import Phosphates
23
+ from gebpy.modules.fluids import Water
24
+ from gebpy.modules.geophysics import Elasticity as elast
25
+ except:
26
+ from modules.chemistry import PeriodicSystem, OxideCompounds
27
+ from modules.oxides import Oxides
28
+ from modules.carbonates import Carbonates
29
+ from modules.silicates import Tectosilicates, Nesosilicates, Sorosilicates, Phyllosilicates, Inosilicates
30
+ from modules.phosphates import Phosphates
31
+ from modules.fluids import Water
32
+ from modules.geophysics import Elasticity as elast
33
+
34
+ #######################
35
+ ## METAMORPHIC ROCKS ##
36
+ #######################
37
+ class GranuliteFacies:
38
+
39
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
40
+ self.fluid = fluid
41
+ self.actualThickness = actual_thickness
42
+ self.porosity = porosity
43
+
44
+ ## Minerals
45
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
46
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
47
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
48
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
49
+
50
+ ## Fluids
51
+ self.data_water = Water.water("")
52
+
53
+ def create_granulite(self, number=1, composition=None, classification="felsic"):
54
+ results_container = {}
55
+ results_container["rock"] = "Granulite"
56
+ results_container["mineralogy"] = {}
57
+ results_container["chemistry"] = {}
58
+ results_container["compounds"] = {}
59
+ results_container["phi"] = []
60
+ results_container["fluid"] = self.fluid
61
+ results_container["rho_s"] = []
62
+ results_container["rho"] = []
63
+ results_container["vP"] = []
64
+ results_container["vS"] = []
65
+ results_container["vP/vS"] = []
66
+ results_container["K"] = []
67
+ results_container["G"] = []
68
+ results_container["E"] = []
69
+ results_container["nu"] = []
70
+ results_container["GR"] = []
71
+ results_container["PE"] = []
72
+
73
+ n = 0
74
+ while n < number:
75
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
76
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
77
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
78
+ data_clinopyroxene = Inosilicates(
79
+ mineral="Clinopyroxene", data_type=True, traces_list=[]).generate_dataset(
80
+ number=1)
81
+ data_orthopyroxene = Inosilicates(
82
+ mineral="Orthopyroxene", data_type=True, traces_list=[]).generate_dataset(
83
+ number=1)
84
+ data_apatite = Phosphates(data_type=True).create_aptite()
85
+
86
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
87
+ "Grt": data_garnet_al, "Opx": data_orthopyroxene, "Cpx": data_clinopyroxene,
88
+ "Ap": data_apatite}
89
+
90
+ minerals_list = list(mineralogy.keys())
91
+
92
+ if minerals_list[0] not in results_container["mineralogy"]:
93
+ for mineral in minerals_list:
94
+ results_container["mineralogy"][mineral] = []
95
+
96
+ condition = False
97
+
98
+ while condition == False:
99
+ elements_list = []
100
+ phi_minerals = {}
101
+ w_minerals = {}
102
+ w_elements = {}
103
+
104
+ if composition != None:
105
+ phi_qz = composition["Qz"]
106
+ phi_kfs = composition["Kfs"]
107
+ phi_pl = composition["Pl"]
108
+ phi_grt = composition["Grt"]
109
+ phi_opx = composition["Opx"]
110
+ phi_cpx = composition["Cpx"]
111
+ phi_ap = composition["Ap"]
112
+
113
+ phi_minerals["Qz"] = phi_qz
114
+ phi_minerals["Kfs"] = phi_kfs
115
+ phi_minerals["Pl"] = phi_pl
116
+ phi_minerals["Grt"] = phi_grt
117
+ phi_minerals["Opx"] = phi_opx
118
+ phi_minerals["Cpx"] = phi_cpx
119
+ phi_minerals["Ap"] = phi_ap
120
+ else:
121
+ condition_2 = False
122
+ while condition_2 == False:
123
+ if classification == "felsic":
124
+ qz_limits = [0.1, 0.26]
125
+ kfs_limits = [0.2, 0.52]
126
+ pl_limits = [0.2, 0.52]
127
+ grt_limits = [0.02, 0.08]
128
+ opx_limits = [0.0, 0.05]
129
+ cpx_limits = [0.0, 0.05]
130
+ ap_limits = [0.0, 0.05]
131
+
132
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
133
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_qz)), 4)
134
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_kfs)), 4)
135
+ phi_grt = round(rd.uniform(grt_limits[0], (1 - phi_qz - phi_kfs - phi_pl)), 4)
136
+ phi_opx = round(rd.uniform(opx_limits[0], (1 - phi_qz - phi_kfs - phi_pl - phi_grt)), 4)
137
+ phi_cpx = round(rd.uniform(
138
+ cpx_limits[0], (1 - phi_qz - phi_kfs - phi_pl - phi_grt - phi_opx)), 4)
139
+ phi_ap = round(1 - phi_qz - phi_kfs - phi_pl - phi_grt - phi_opx - phi_cpx, 4)
140
+ elif classification == "mafic":
141
+ qz_limits = [0.0, 0.12]
142
+ kfs_limits = [0.0, 0.04]
143
+ pl_limits = [0.05, 0.25]
144
+ grt_limits = [0.02, 0.08]
145
+ opx_limits = [0.2, 0.52]
146
+ cpx_limits = [0.2, 0.52]
147
+ ap_limits = [0.0, 0.05]
148
+
149
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
150
+ phi_opx = round(rd.uniform(opx_limits[0], (1 - phi_qz)), 4)
151
+ phi_cpx = round(rd.uniform(cpx_limits[0], (1 - phi_qz - phi_opx)), 4)
152
+ phi_grt = round(rd.uniform(grt_limits[0], (1 - phi_qz - phi_opx - phi_cpx)), 4)
153
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_opx - phi_cpx - phi_grt)), 4)
154
+ phi_kfs = round(rd.uniform(
155
+ kfs_limits[0], (1 - phi_qz - phi_opx - phi_cpx - phi_grt - phi_pl)), 4)
156
+ phi_ap = round(1 - phi_qz - phi_opx - phi_cpx - phi_grt - phi_pl - phi_kfs, 4)
157
+
158
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_grt + phi_opx + phi_cpx + phi_ap
159
+
160
+ if np.isclose(phi_total, 1.0000) == True:
161
+ if (qz_limits[0] <= phi_qz <= qz_limits[1] and kfs_limits[0] <= phi_kfs <= kfs_limits[1]
162
+ and pl_limits[0] <= phi_pl <= pl_limits[1]
163
+ and grt_limits[0] <= phi_grt <= grt_limits[1] \
164
+ and opx_limits[0] <= phi_opx <= opx_limits[1] \
165
+ and cpx_limits[0] <= phi_cpx <= cpx_limits[1]
166
+ and ap_limits[0] <= phi_ap <= ap_limits[1]):
167
+ condition_2 = True
168
+
169
+ phi_minerals["Qz"] = phi_qz
170
+ phi_minerals["Kfs"] = phi_kfs
171
+ phi_minerals["Pl"] = phi_pl
172
+ phi_minerals["Grt"] = phi_grt
173
+ phi_minerals["Opx"] = phi_opx
174
+ phi_minerals["Cpx"] = phi_cpx
175
+ phi_minerals["Ap"] = phi_ap
176
+
177
+ rho_s = 0
178
+ for key, value in phi_minerals.items():
179
+ try:
180
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
181
+ except:
182
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"][0]
183
+
184
+ for element, value in mineralogy[key]["chemistry"].items():
185
+ if element not in elements_list:
186
+ elements_list.append(element)
187
+ w_elements[element] = 0.0
188
+
189
+ if elements_list[0] not in results_container["chemistry"]:
190
+ for element in elements_list:
191
+ results_container["chemistry"][element] = []
192
+
193
+ rho_s = round(rho_s, 3)
194
+ for key, value in phi_minerals.items():
195
+ if key == "Urn":
196
+ n_digits = 4
197
+ else:
198
+ n_digits = 4
199
+
200
+ try:
201
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
202
+ except:
203
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"][0])/rho_s, n_digits)
204
+
205
+ if self.porosity == None:
206
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
207
+ else:
208
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
209
+
210
+ if self.fluid == "water":
211
+ data_fluid = self.data_water
212
+
213
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
214
+
215
+ old_index = elements_list.index("O")
216
+ elements_list += [elements_list.pop(old_index)]
217
+
218
+ w_elements_total = 0.0
219
+ for element in elements_list:
220
+ if element != "O":
221
+ for mineral, w_mineral in w_minerals.items():
222
+ if element in mineralogy[mineral]["chemistry"]:
223
+ if element == "U":
224
+ n_digits = 4
225
+ else:
226
+ n_digits = 4
227
+
228
+ try:
229
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
230
+ except:
231
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element][0], n_digits)
232
+
233
+ w_elements[element] += value
234
+ w_elements_total += value
235
+
236
+ w_elements[element] = round(w_elements[element], n_digits)
237
+ elif element == "O":
238
+ w_elements[element] += round(1 - w_elements_total, 4)
239
+ w_elements[element] = round(w_elements[element], 4)
240
+
241
+ total_w_minerals = round(sum(w_minerals.values()), 4)
242
+ total_w_elements = round(sum(w_elements.values()), 4)
243
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
244
+ for key, value in w_minerals.items():
245
+ w_minerals[key] = abs(value)
246
+
247
+ for key, value in w_elements.items():
248
+ w_elements[key] = abs(value)
249
+
250
+ condition = True
251
+
252
+ gamma_ray = 0.0
253
+ photoelectricity = 0.0
254
+
255
+ K_list = []
256
+ G_list = []
257
+ phi_list = []
258
+ for key, value in phi_minerals.items():
259
+ try:
260
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
261
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
262
+
263
+ gamma_ray = round(gamma_ray, 3)
264
+ photoelectricity = round(photoelectricity, 3)
265
+
266
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
267
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
268
+ phi_list.append(phi_minerals[key])
269
+ except:
270
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"][0]
271
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"][0]
272
+
273
+ gamma_ray = round(gamma_ray, 3)
274
+ photoelectricity = round(photoelectricity, 3)
275
+
276
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"][0], 3))
277
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"][0], 3))
278
+ phi_list.append(phi_minerals[key])
279
+
280
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
281
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
282
+
283
+ anisotropic_factor = round(rd.uniform(0.415, 0.425), 2)
284
+
285
+ bulk_mod = K_geo/anisotropic_factor
286
+ shear_mod = G_geo/anisotropic_factor
287
+
288
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
289
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
290
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
291
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
292
+ vPvS = round(vP/vS, 6)
293
+
294
+ for key, value in w_minerals.items():
295
+ results_container["mineralogy"][key].append(value)
296
+
297
+ amounts = []
298
+ for key, value in w_elements.items():
299
+ results_container["chemistry"][key].append(value)
300
+ chem_data = PeriodicSystem(name=key).get_data()
301
+ amounts.append([key, chem_data[1], value])
302
+
303
+ list_elements = list(w_elements.keys())
304
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
305
+ composition_oxides = {}
306
+
307
+ for var_oxide in list_oxides:
308
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
309
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
310
+
311
+ if list_oxides[0] not in results_container["compounds"]:
312
+ for oxide in list_oxides:
313
+ results_container["compounds"][oxide] = []
314
+
315
+ for key, value in composition_oxides.items():
316
+ results_container["compounds"][key].append(value)
317
+
318
+ results_container["mineralogy"] = dict(sorted(
319
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
320
+ results_container["chemistry"] = dict(sorted(
321
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
322
+ results_container["compounds"] = dict(sorted(
323
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
324
+
325
+ results_container["phi"].append(var_porosity)
326
+ results_container["rho_s"].append(rho_s)
327
+ results_container["rho"].append(rho)
328
+ results_container["vP"].append(vP)
329
+ results_container["vS"].append(vS)
330
+ results_container["vP/vS"].append(vPvS)
331
+ results_container["K"].append(bulk_mod)
332
+ results_container["G"].append(shear_mod)
333
+ results_container["E"].append(youngs_mod)
334
+ results_container["nu"].append(poisson_rat)
335
+ results_container["GR"].append(gamma_ray)
336
+ results_container["PE"].append(photoelectricity)
337
+
338
+ n += 1
339
+
340
+ return results_container
341
+
342
+ class MetamorphicRocks:
343
+ #
344
+ def __init__(self, fluid="water", actualThickness=100, porosity=None):
345
+ self.fluid = fluid
346
+ self.actualThickness = actualThickness
347
+ self.porosity = porosity
348
+
349
+ ## Minerals
350
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
351
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
352
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
353
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
354
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
355
+ self.data_magnetite = Oxides(data_type=True).create_magnetite()
356
+ self.data_hematite = Oxides(data_type=True).create_hematite()
357
+ self.data_calcite = Carbonates(data_type=True).create_calcite()
358
+ self.data_dolomite = Carbonates(data_type=True).create_dolomite()
359
+
360
+ ## Fluids
361
+ self.data_water = Water.water("")
362
+
363
+ def create_greenstone(self, number=1, composition=None):
364
+ results_container = {}
365
+ results_container["rock"] = "Greenschist"
366
+ results_container["mineralogy"] = {}
367
+ results_container["chemistry"] = {}
368
+ results_container["compounds"] = {}
369
+ results_container["phi"] = []
370
+ results_container["fluid"] = self.fluid
371
+ results_container["rho_s"] = []
372
+ results_container["rho"] = []
373
+ results_container["vP"] = []
374
+ results_container["vS"] = []
375
+ results_container["vP/vS"] = []
376
+ results_container["K"] = []
377
+ results_container["G"] = []
378
+ results_container["E"] = []
379
+ results_container["nu"] = []
380
+ results_container["GR"] = []
381
+ results_container["PE"] = []
382
+
383
+ n = 0
384
+ while n < number: # sex
385
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
386
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
387
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(enrichment="Na")
388
+ data_apatite = Phosphates(data_type=True).create_aptite()
389
+
390
+ mineralogy = {"Chl": data_chlorite, "Pl": data_plagioclase, "Qz": self.data_quartz, "Ep": self.data_epidote,
391
+ "Act": data_actinolite, "Mag": self.data_magnetite, "Cal": self.data_calcite,
392
+ "Ap": data_apatite}
393
+
394
+ minerals_list = list(mineralogy.keys())
395
+
396
+ if minerals_list[0] not in results_container["mineralogy"]:
397
+ for mineral in minerals_list:
398
+ results_container["mineralogy"][mineral] = []
399
+
400
+ if self.porosity == None:
401
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
402
+ else:
403
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
404
+
405
+ condition = False
406
+
407
+ while condition == False:
408
+ elements_list = []
409
+ phi_minerals = {}
410
+ w_minerals = {}
411
+ w_elements = {}
412
+
413
+ if composition != None:
414
+ phi_chl = composition["Chl"]
415
+ phi_pl = composition["Pl"]
416
+ phi_qz = composition["Qz"]
417
+ phi_ep = composition["Ep"]
418
+ phi_act = composition["Act"]
419
+ phi_mag = composition["Mag"]
420
+ phi_cal = composition["Cal"]
421
+ phi_ap = composition["Ap"]
422
+
423
+ phi_minerals["Chl"] = phi_chl
424
+ phi_minerals["Pl"] = phi_pl
425
+ phi_minerals["Qz"] = phi_qz
426
+ phi_minerals["Ep"] = phi_ep
427
+ phi_minerals["Act"] = phi_act
428
+ phi_minerals["Mag"] = phi_mag
429
+ phi_minerals["Cal"] = phi_cal
430
+ phi_minerals["Ap"] = phi_ap
431
+ else:
432
+ condition_2 = False
433
+ while condition_2 == False:
434
+ phi_chl = round(rd.uniform(0.35, 0.50), 4)
435
+ phi_pl = round(rd.uniform(0.15, 0.25), 4)
436
+ phi_qz = round(rd.uniform(0.1, 0.2), 4)
437
+ phi_ep = round(rd.uniform(0.05, (1.0 - phi_chl - phi_pl - phi_qz)), 4)
438
+ phi_act = round(rd.uniform(0.05, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep)), 4)
439
+ phi_mag = round(rd.uniform(0.002, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act)), 4)
440
+ phi_cal = round(
441
+ rd.uniform(0.0, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act - phi_mag)), 4)
442
+ phi_ap = round(1 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act - phi_mag - phi_cal, 4)
443
+ phi_total = phi_chl + phi_pl + phi_qz + phi_ep + phi_act + phi_mag + phi_cal + phi_ap
444
+
445
+ if np.isclose(phi_total, 1.0000) == True:
446
+ if (0.35 <= phi_chl <= 0.5 and 0.15 <= phi_pl <= 0.25 and 0.1 <= phi_qz <= 0.2
447
+ and 0.05 <= phi_ep <= 0.15 and 0.05 <= phi_act <= 0.1 and 0.02 <= phi_mag <= 0.05
448
+ and 0.02 <= phi_cal <= 0.05 and 0.0 <= phi_ap <= 0.05):
449
+ condition_2 = True
450
+
451
+ phi_minerals["Chl"] = phi_chl
452
+ phi_minerals["Pl"] = phi_pl
453
+ phi_minerals["Qz"] = phi_qz
454
+ phi_minerals["Ep"] = phi_ep
455
+ phi_minerals["Act"] = phi_act
456
+ phi_minerals["Mag"] = phi_mag
457
+ phi_minerals["Cal"] = phi_cal
458
+ phi_minerals["Ap"] = phi_ap
459
+
460
+ rho_s = 0
461
+ velocities_minerals = {}
462
+ for key, value in phi_minerals.items():
463
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
464
+
465
+ velocities_minerals[key] = {}
466
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
467
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
468
+
469
+ for element, value in mineralogy[key]["chemistry"].items():
470
+ if element not in elements_list:
471
+ elements_list.append(element)
472
+ w_elements[element] = 0.0
473
+
474
+ if elements_list[0] not in results_container["chemistry"]:
475
+ for element in elements_list:
476
+ results_container["chemistry"][element] = []
477
+
478
+ rho_s = round(rho_s, 3)
479
+
480
+ for key, value in phi_minerals.items():
481
+ if key == "Urn":
482
+ n_digits = 4
483
+ else:
484
+ n_digits = 4
485
+
486
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
487
+
488
+ if self.fluid == "water":
489
+ data_fluid = self.data_water
490
+ elif self.fluid == "oil":
491
+ data_fluid = self.data_oil
492
+ elif self.fluid == "gas":
493
+ data_fluid = self.data_gas
494
+
495
+ old_index = elements_list.index("O")
496
+ elements_list += [elements_list.pop(old_index)]
497
+
498
+ w_elements_total = 0.0
499
+ for element in elements_list:
500
+ if element != "O":
501
+ for mineral, w_mineral in w_minerals.items():
502
+ if element in mineralogy[mineral]["chemistry"]:
503
+ if element == "U":
504
+ n_digits = 4
505
+ else:
506
+ n_digits = 4
507
+
508
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
509
+ w_elements[element] += value
510
+ w_elements_total += value
511
+
512
+ w_elements[element] = round(w_elements[element], n_digits)
513
+ elif element == "O":
514
+ w_elements[element] += round(1 - w_elements_total, 4)
515
+ w_elements[element] = round(w_elements[element], 4)
516
+
517
+ total_w_minerals = round(sum(w_minerals.values()), 4)
518
+ total_w_elements = round(sum(w_elements.values()), 4)
519
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
520
+ for key, value in w_minerals.items():
521
+ w_minerals[key] = abs(value)
522
+
523
+ for key, value in w_elements.items():
524
+ w_elements[key] = abs(value)
525
+
526
+ condition = True
527
+
528
+ gamma_ray = 0.0
529
+ photoelectricity = 0.0
530
+
531
+ K_list = []
532
+ G_list = []
533
+ bulk_mod = 0
534
+ shear_mod = 0
535
+ phi_list = []
536
+ for key, value in phi_minerals.items():
537
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
538
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
539
+
540
+ gamma_ray = round(gamma_ray, 3)
541
+ photoelectricity = round(photoelectricity, 3)
542
+
543
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
544
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
545
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
546
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
547
+ phi_list.append(phi_minerals[key])
548
+
549
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
550
+ bulk_mod = round(bulk_mod, 3)
551
+ shear_mod = round(shear_mod, 3)
552
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
553
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
554
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
555
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
556
+ vPvS = round(vP/vS, 3)
557
+
558
+ ## RESULTS
559
+ for key, value in w_minerals.items():
560
+ results_container["mineralogy"][key].append(value)
561
+
562
+ amounts = []
563
+ for key, value in w_elements.items():
564
+ results_container["chemistry"][key].append(value)
565
+ chem_data = PeriodicSystem(name=key).get_data()
566
+ amounts.append([key, chem_data[1], value])
567
+
568
+ list_elements = list(w_elements.keys())
569
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
570
+ composition_oxides = {}
571
+
572
+ for var_oxide in list_oxides:
573
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
574
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
575
+
576
+ if list_oxides[0] not in results_container["compounds"]:
577
+ for oxide in list_oxides:
578
+ results_container["compounds"][oxide] = []
579
+
580
+ for key, value in composition_oxides.items():
581
+ results_container["compounds"][key].append(value)
582
+
583
+ results_container["mineralogy"] = dict(sorted(
584
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
585
+ results_container["chemistry"] = dict(sorted(
586
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
587
+ results_container["compounds"] = dict(sorted(
588
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
589
+
590
+ results_container["phi"].append(phi_helper)
591
+ results_container["rho_s"].append(rho_s)
592
+ results_container["rho"].append(rho)
593
+ results_container["vP"].append(vP)
594
+ results_container["vS"].append(vS)
595
+ results_container["vP/vS"].append(vPvS)
596
+ results_container["K"].append(bulk_mod)
597
+ results_container["G"].append(shear_mod)
598
+ results_container["E"].append(youngs_mod)
599
+ results_container["nu"].append(poisson_rat)
600
+ results_container["GR"].append(gamma_ray)
601
+ results_container["PE"].append(photoelectricity)
602
+
603
+ n += 1
604
+
605
+ return results_container
606
+
607
+ def create_granulite(self, number, porosity=None):
608
+ #
609
+ self.data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
610
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
611
+ self.data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
612
+ #
613
+ assemblage = [self.data_quartz, self.data_alkalifeldspar, self.data_plagioclase, self.data_garnet_al,
614
+ self.data_kyanite, self.data_sillimanite]
615
+ #
616
+ amounts_mineralogy = {}
617
+ amounts_chemistry = {}
618
+ bulk_properties = {}
619
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
620
+ for property in properties:
621
+ bulk_properties[property] = []
622
+ mineral_list = []
623
+ elements = []
624
+ for mineral in assemblage:
625
+ amounts_mineralogy[mineral["mineral"]] = []
626
+ mineral_list.append(mineral["mineral"])
627
+ elements_mineral = list(mineral["chemistry"].keys())
628
+ for element in elements_mineral:
629
+ if element not in elements:
630
+ elements.append(element)
631
+ amounts_chemistry[element] = []
632
+ mineral_list.sort()
633
+ elements.sort()
634
+ #
635
+ n = 0
636
+ amounts_helper = []
637
+ while n < number:
638
+ w_total = 0
639
+ n_minerals = 0
640
+ #x = round(rd.uniform(0.0, 1.0), 4)
641
+ for mineral in mineral_list:
642
+ if mineral == "Qz":
643
+ if n_minerals < len(mineral_list)-1:
644
+ value = round(rd.uniform(0.25, 0.65), 4)
645
+ #value = round(0.65 - 0.35*x, 4)
646
+ else:
647
+ value = round(1-w_total, 4)
648
+ if value >= 0.0 and 0.25 <= value <= 0.65:
649
+ amounts_helper.append(value)
650
+ w_total += value
651
+ n_minerals += 1
652
+ elif mineral == "Kfs":
653
+ if n_minerals < len(mineral_list)-1:
654
+ value = round(rd.uniform(0.0, 0.60), 4)
655
+ #value = round(0.10 + 0.50*x, 4)
656
+ else:
657
+ value = round(1-w_total, 4)
658
+ if value >= 0.0 and 0.0 <= value <= 0.60:
659
+ amounts_helper.append(value)
660
+ w_total += value
661
+ n_minerals += 1
662
+ elif mineral == "Pl":
663
+ if n_minerals < len(mineral_list)-1:
664
+ value = round(rd.uniform(0.0, 0.60), 4)
665
+ #value = round(0.15 - 0.5*x, 4)
666
+ else:
667
+ value = round(1-w_total, 4)
668
+ if value >= 0.0 and 0.0 <= value <= 0.60:
669
+ amounts_helper.append(value)
670
+ w_total += value
671
+ n_minerals += 1
672
+ elif mineral == "Grt":
673
+ if n_minerals < len(mineral_list)-1:
674
+ value = round(rd.uniform(0.0, 0.05), 4)
675
+ #value = round(0.05*(1-x), 4)
676
+ else:
677
+ value = round(1-w_total, 4)
678
+ if value >= 0.0 and 0.0 <= value <= 0.05:
679
+ amounts_helper.append(value)
680
+ w_total += value
681
+ n_minerals += 1
682
+ elif mineral == "Ky":
683
+ if n_minerals < len(mineral_list)-1:
684
+ value = round(rd.uniform(0.0, 0.03), 4)
685
+ #value = round(0.025*(1-x), 4)
686
+ else:
687
+ value = round(1-w_total, 4)
688
+ if value >= 0.0 and 0.0 <= value <= 0.025:
689
+ amounts_helper.append(value)
690
+ w_total += value
691
+ n_minerals += 1
692
+ elif mineral == "Sil":
693
+ if n_minerals < len(mineral_list)-1:
694
+ value = round(1-w_total, 4)
695
+ #value = round(0.025*(1-x), 4)
696
+ else:
697
+ value = round(1-w_total, 4)
698
+ if value >= 0.0 and 0.0 <= value <= 0.025:
699
+ amounts_helper.append(value)
700
+ w_total += value
701
+ n_minerals += 1
702
+ #
703
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
704
+ for index, mineral in enumerate(mineral_list):
705
+ amounts_mineralogy[mineral].append(amounts_helper[index])
706
+ n += 1
707
+ amounts_helper.clear()
708
+ else:
709
+ n += 0
710
+ amounts_helper.clear()
711
+ #
712
+ n = 0
713
+ amounts_helper = {}
714
+ while n < number:
715
+ w_total = 0
716
+ n_elements = 0
717
+ rho_s_helper = 0
718
+ rho_helper = 0
719
+ bulkmod_helper = 0
720
+ shearmod_helper = 0
721
+ youngsmod_helper = 0
722
+ poisson_helper = 0
723
+ vP_helper = 0
724
+ vS_helper = 0
725
+ vPvS_helper = 0
726
+ gr_helper = 0
727
+ pe_helper = 0
728
+ if porosity == None:
729
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
730
+ else:
731
+ phi_helper = porosity
732
+ self.data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
733
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
734
+ self.data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
735
+ for element in elements:
736
+ amounts_helper[element] = 0
737
+ if element in self.data_quartz["chemistry"]:
738
+ if n_elements < len(elements)-1:
739
+ value = round(amounts_mineralogy["Qz"][n]*self.data_quartz["chemistry"][element], 4)
740
+ else:
741
+ value = round(1-w_total, 4)
742
+ amounts_helper[element] += value
743
+ w_total += value
744
+ if element in self.data_alkalifeldspar["chemistry"]:
745
+ if n_elements < len(elements)-1:
746
+ value = round(amounts_mineralogy["Kfs"][n]*self.data_alkalifeldspar["chemistry"][element], 4)
747
+ else:
748
+ value = round(1-w_total, 4)
749
+ amounts_helper[element] += value
750
+ w_total += value
751
+ if element in self.data_plagioclase["chemistry"]:
752
+ if n_elements < len(elements)-1:
753
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
754
+ else:
755
+ value = round(1-w_total, 4)
756
+ amounts_helper[element] += value
757
+ w_total += value
758
+ if element in self.data_garnet_al["chemistry"]:
759
+ if n_elements < len(elements)-1:
760
+ value = round(amounts_mineralogy["Grt"][n]*self.data_garnet_al["chemistry"][element], 4)
761
+ else:
762
+ value = round(1-w_total, 4)
763
+ amounts_helper[element] += value
764
+ w_total += value
765
+ if element in self.data_kyanite["chemistry"]:
766
+ if n_elements < len(elements)-1:
767
+ value = round(amounts_mineralogy["Ky"][n]*self.data_kyanite["chemistry"][element], 4)
768
+ else:
769
+ value = round(1-w_total, 4)
770
+ amounts_helper[element] += value
771
+ w_total += value
772
+ if element in self.data_sillimanite["chemistry"]:
773
+ if n_elements < len(elements)-1:
774
+ value = round(amounts_mineralogy["Sil"][n]*self.data_sillimanite["chemistry"][element], 4)
775
+ else:
776
+ value = round(1-w_total, 4)
777
+ amounts_helper[element] += value
778
+ w_total += value
779
+ n_elements += 1
780
+ if sum(amounts_helper.values()) == 1.0:
781
+ for key, value in amounts_helper.items():
782
+ amounts_chemistry[key].append(round(value, 4))
783
+ for mineral in mineral_list:
784
+ if mineral == "Qz":
785
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["rho"], 3)
786
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["K"], 3)
787
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_quartz["G"], 3)
788
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["GR"], 3)
789
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["PE"], 3)
790
+ elif mineral == "Kfs":
791
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["rho"], 3)
792
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["K"], 3)
793
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["G"], 3)
794
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["GR"], 3)
795
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["PE"], 3)
796
+ elif mineral == "Pl":
797
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
798
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
799
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
800
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
801
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
802
+ elif mineral == "Grt":
803
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["rho"], 3)
804
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["K"], 3)
805
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_garnet_al["G"], 3)
806
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["GR"], 3)
807
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["PE"], 3)
808
+ elif mineral == "Ky":
809
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["rho"], 3)
810
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["K"], 3)
811
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_kyanite["G"], 3)
812
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["GR"], 3)
813
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["PE"], 3)
814
+ elif mineral == "Sil":
815
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["rho"], 3)
816
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["K"], 3)
817
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_sillimanite["G"], 3)
818
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["GR"], 3)
819
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["PE"], 3)
820
+ #
821
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
822
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
823
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
824
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
825
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
826
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
827
+ #
828
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
829
+ bulk_properties["rho"].append(rho_helper)
830
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
831
+ bulk_properties["G"].append(round(shearmod_helper, 3))
832
+ bulk_properties["E"].append(youngsmod_helper)
833
+ bulk_properties["nu"].append(poisson_helper)
834
+ bulk_properties["vP"].append(vP_helper)
835
+ bulk_properties["vS"].append(vS_helper)
836
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
837
+ bulk_properties["GR"].append(round(gr_helper, 3))
838
+ bulk_properties["PE"].append(round(pe_helper, 3))
839
+ bulk_properties["phi"].append(round(phi_helper, 3))
840
+ n += 1
841
+ #
842
+ # for key, value in amounts_mineralogy.items():
843
+ # print("Mineral:", key, "Mean:", round(np.mean(value)*100, 4), "STD:", round(np.std(value, ddof=1)*100, 4))
844
+ # print("")
845
+ # for key, value in amounts_chemistry.items():
846
+ # print("Element:", key, "Mean:", round(np.mean(value)*100, 4), "STD:", round(np.std(value, ddof=1)*100, 4))
847
+ # print("")
848
+ # for key, value in bulk_properties.items():
849
+ # print("Property:", key, "Mean:", round(np.mean(value), 4), "STD:", round(np.std(value, ddof=1), 4))
850
+ #
851
+ results = {}
852
+ results["rock"] = "Granulite"
853
+ if number > 1:
854
+ results["mineralogy"] = amounts_mineralogy
855
+ results["chemistry"] = amounts_chemistry
856
+ results["phi"] = bulk_properties["phi"]
857
+ results["fluid"] = "water"
858
+ results["rho_s"] = bulk_properties["rho_s"]
859
+ results["rho"] = bulk_properties["rho"]
860
+ results["vP"] = bulk_properties["vP"]
861
+ results["vS"] = bulk_properties["vS"]
862
+ results["vP/vS"] = bulk_properties["vPvS"]
863
+ results["K"] = bulk_properties["K"]
864
+ results["G"] = bulk_properties["G"]
865
+ results["E"] = bulk_properties["E"]
866
+ results["nu"] = bulk_properties["nu"]
867
+ results["GR"] = bulk_properties["GR"]
868
+ results["PE"] = bulk_properties["PE"]
869
+ else:
870
+ single_amounts_mineralogy = {}
871
+ single_amounts_chemistry = {}
872
+ for mineral, value in amounts_mineralogy.items():
873
+ single_amounts_mineralogy[mineral] = value[0]
874
+ for element, value in amounts_chemistry.items():
875
+ single_amounts_chemistry[element] = value[0]
876
+ results["mineralogy"] = single_amounts_mineralogy
877
+ results["chemistry"] = single_amounts_chemistry
878
+ results["phi"] = bulk_properties["phi"][0]
879
+ results["fluid"] = "water"
880
+ results["rho_s"] = bulk_properties["rho_s"][0]
881
+ results["rho"] = bulk_properties["rho"][0]
882
+ results["vP"] = bulk_properties["vP"][0]
883
+ results["vS"] = bulk_properties["vS"][0]
884
+ results["vP/vS"] = bulk_properties["vPvS"][0]
885
+ results["K"] = bulk_properties["K"][0]
886
+ results["G"] = bulk_properties["G"][0]
887
+ results["E"] = bulk_properties["E"][0]
888
+ results["nu"] = bulk_properties["nu"][0]
889
+ results["GR"] = bulk_properties["GR"][0]
890
+ results["PE"] = bulk_properties["PE"][0]
891
+ #
892
+ return results
893
+ #
894
+ class GreenschistFacies:
895
+ #
896
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
897
+ self.fluid = fluid
898
+ self.actualThickness = actual_thickness
899
+ self.porosity = porosity
900
+
901
+ ## Minerals
902
+ self.data_brucite = Oxides(impurity="pure", data_type=True).create_brucite()
903
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
904
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
905
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
906
+ self.data_diopside = Inosilicates(impurity="pure", data_type=True).create_diopside()
907
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
908
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
909
+ self.data_chrysotile = Phyllosilicates(impurity="pure", data_type=True).create_chrysotile()
910
+ self.data_pyrophyllite = Phyllosilicates(impurity="pure", data_type=True).create_pyrophyllite()
911
+ self.data_talc = Phyllosilicates(impurity="pure", data_type=True).create_talc()
912
+ self.data_magnetite = Oxides(data_type=True).create_magnetite()
913
+ self.data_hematite = Oxides(data_type=True).create_hematite()
914
+ self.data_calcite = Carbonates(data_type=True).create_calcite()
915
+ self.data_dolomite = Carbonates(data_type=True).create_dolomite()
916
+
917
+ ## Fluids
918
+ self.data_water = Water.water("")
919
+
920
+ def create_greenstone(self, number=1, composition=None):
921
+ results_container = {}
922
+ results_container["rock"] = "Greenstone"
923
+ results_container["mineralogy"] = {}
924
+ results_container["chemistry"] = {}
925
+ results_container["compounds"] = {}
926
+ results_container["phi"] = []
927
+ results_container["fluid"] = self.fluid
928
+ results_container["rho_s"] = []
929
+ results_container["rho"] = []
930
+ results_container["vP"] = []
931
+ results_container["vS"] = []
932
+ results_container["vP/vS"] = []
933
+ results_container["K"] = []
934
+ results_container["G"] = []
935
+ results_container["E"] = []
936
+ results_container["nu"] = []
937
+ results_container["GR"] = []
938
+ results_container["PE"] = []
939
+
940
+ n = 0
941
+ while n < number: # sex
942
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
943
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
944
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(enrichment="Na")
945
+ data_apatite = Phosphates(data_type=True).create_aptite()
946
+
947
+ mineralogy = {"Chl": data_chlorite, "Pl": data_plagioclase, "Qz": self.data_quartz, "Ep": self.data_epidote,
948
+ "Act": data_actinolite, "Mag": self.data_magnetite, "Cal": self.data_calcite,
949
+ "Ap": data_apatite}
950
+
951
+ minerals_list = list(mineralogy.keys())
952
+
953
+ if minerals_list[0] not in results_container["mineralogy"]:
954
+ for mineral in minerals_list:
955
+ results_container["mineralogy"][mineral] = []
956
+
957
+ if self.porosity == None:
958
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
959
+ else:
960
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
961
+
962
+ condition = False
963
+
964
+ while condition == False:
965
+ elements_list = []
966
+ phi_minerals = {}
967
+ w_minerals = {}
968
+ w_elements = {}
969
+
970
+ if composition != None:
971
+ phi_chl = composition["Chl"]
972
+ phi_pl = composition["Pl"]
973
+ phi_qz = composition["Qz"]
974
+ phi_ep = composition["Ep"]
975
+ phi_act = composition["Act"]
976
+ phi_mag = composition["Mag"]
977
+ phi_cal = composition["Cal"]
978
+ phi_ap = composition["Ap"]
979
+
980
+ phi_minerals["Chl"] = phi_chl
981
+ phi_minerals["Pl"] = phi_pl
982
+ phi_minerals["Qz"] = phi_qz
983
+ phi_minerals["Ep"] = phi_ep
984
+ phi_minerals["Act"] = phi_act
985
+ phi_minerals["Mag"] = phi_mag
986
+ phi_minerals["Cal"] = phi_cal
987
+ phi_minerals["Ap"] = phi_ap
988
+ else:
989
+ condition_2 = False
990
+ while condition_2 == False:
991
+ phi_chl = round(rd.uniform(0.35, 0.50), 4)
992
+ phi_pl = round(rd.uniform(0.15, 0.25), 4)
993
+ phi_qz = round(rd.uniform(0.1, 0.2), 4)
994
+ phi_ep = round(rd.uniform(0.05, (1.0 - phi_chl - phi_pl - phi_qz)), 4)
995
+ phi_act = round(rd.uniform(0.05, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep)), 4)
996
+ phi_mag = round(rd.uniform(0.002, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act)), 4)
997
+ phi_cal = round(
998
+ rd.uniform(0.0, (1.0 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act - phi_mag)), 4)
999
+ phi_ap = round(1 - phi_chl - phi_pl - phi_qz - phi_ep - phi_act - phi_mag - phi_cal, 4)
1000
+ phi_total = phi_chl + phi_pl + phi_qz + phi_ep + phi_act + phi_mag + phi_cal + phi_ap
1001
+
1002
+ if np.isclose(phi_total, 1.0000) == True:
1003
+ if (0.35 <= phi_chl <= 0.5 and 0.15 <= phi_pl <= 0.25 and 0.1 <= phi_qz <= 0.2
1004
+ and 0.05 <= phi_ep <= 0.15 and 0.05 <= phi_act <= 0.1 and 0.02 <= phi_mag <= 0.05
1005
+ and 0.02 <= phi_cal <= 0.05 and 0.0 <= phi_ap <= 0.05):
1006
+ condition_2 = True
1007
+
1008
+ phi_minerals["Chl"] = phi_chl
1009
+ phi_minerals["Pl"] = phi_pl
1010
+ phi_minerals["Qz"] = phi_qz
1011
+ phi_minerals["Ep"] = phi_ep
1012
+ phi_minerals["Act"] = phi_act
1013
+ phi_minerals["Mag"] = phi_mag
1014
+ phi_minerals["Cal"] = phi_cal
1015
+ phi_minerals["Ap"] = phi_ap
1016
+
1017
+ rho_s = 0
1018
+ velocities_minerals = {}
1019
+ for key, value in phi_minerals.items():
1020
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1021
+
1022
+ velocities_minerals[key] = {}
1023
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1024
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1025
+
1026
+ for element, value in mineralogy[key]["chemistry"].items():
1027
+ if element not in elements_list:
1028
+ elements_list.append(element)
1029
+ w_elements[element] = 0.0
1030
+
1031
+ if elements_list[0] not in results_container["chemistry"]:
1032
+ for element in elements_list:
1033
+ results_container["chemistry"][element] = []
1034
+
1035
+ rho_s = round(rho_s, 3)
1036
+
1037
+ for key, value in phi_minerals.items():
1038
+ if key == "Urn":
1039
+ n_digits = 4
1040
+ else:
1041
+ n_digits = 4
1042
+
1043
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1044
+
1045
+ if self.fluid == "water":
1046
+ data_fluid = self.data_water
1047
+ elif self.fluid == "oil":
1048
+ data_fluid = self.data_oil
1049
+ elif self.fluid == "gas":
1050
+ data_fluid = self.data_gas
1051
+
1052
+ old_index = elements_list.index("O")
1053
+ elements_list += [elements_list.pop(old_index)]
1054
+
1055
+ w_elements_total = 0.0
1056
+ for element in elements_list:
1057
+ if element != "O":
1058
+ for mineral, w_mineral in w_minerals.items():
1059
+ if element in mineralogy[mineral]["chemistry"]:
1060
+ if element == "U":
1061
+ n_digits = 4
1062
+ else:
1063
+ n_digits = 4
1064
+
1065
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1066
+ w_elements[element] += value
1067
+ w_elements_total += value
1068
+
1069
+ w_elements[element] = round(w_elements[element], n_digits)
1070
+ elif element == "O":
1071
+ w_elements[element] += round(1 - w_elements_total, 4)
1072
+ w_elements[element] = round(w_elements[element], 4)
1073
+
1074
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1075
+ total_w_elements = round(sum(w_elements.values()), 4)
1076
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
1077
+ for key, value in w_minerals.items():
1078
+ w_minerals[key] = abs(value)
1079
+
1080
+ for key, value in w_elements.items():
1081
+ w_elements[key] = abs(value)
1082
+
1083
+ condition = True
1084
+
1085
+ gamma_ray = 0.0
1086
+ photoelectricity = 0.0
1087
+
1088
+ K_list = []
1089
+ G_list = []
1090
+ bulk_mod = 0
1091
+ shear_mod = 0
1092
+ phi_list = []
1093
+ for key, value in phi_minerals.items():
1094
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1095
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1096
+
1097
+ gamma_ray = round(gamma_ray, 3)
1098
+ photoelectricity = round(photoelectricity, 3)
1099
+
1100
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1101
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1102
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1103
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1104
+ phi_list.append(phi_minerals[key])
1105
+
1106
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1107
+ bulk_mod = round(bulk_mod, 3)
1108
+ shear_mod = round(shear_mod, 3)
1109
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1110
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1111
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1112
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1113
+ vPvS = round(vP/vS, 3)
1114
+
1115
+ ## RESULTS
1116
+ for key, value in w_minerals.items():
1117
+ results_container["mineralogy"][key].append(value)
1118
+
1119
+ amounts = []
1120
+ for key, value in w_elements.items():
1121
+ results_container["chemistry"][key].append(value)
1122
+ chem_data = PeriodicSystem(name=key).get_data()
1123
+ amounts.append([key, chem_data[1], value])
1124
+
1125
+ list_elements = list(w_elements.keys())
1126
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1127
+ composition_oxides = {}
1128
+
1129
+ for var_oxide in list_oxides:
1130
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1131
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1132
+
1133
+ if list_oxides[0] not in results_container["compounds"]:
1134
+ for oxide in list_oxides:
1135
+ results_container["compounds"][oxide] = []
1136
+
1137
+ for key, value in composition_oxides.items():
1138
+ results_container["compounds"][key].append(value)
1139
+
1140
+ results_container["mineralogy"] = dict(sorted(
1141
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1142
+ results_container["chemistry"] = dict(sorted(
1143
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1144
+ results_container["compounds"] = dict(sorted(
1145
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1146
+
1147
+ results_container["phi"].append(phi_helper)
1148
+ results_container["rho_s"].append(rho_s)
1149
+ results_container["rho"].append(rho)
1150
+ results_container["vP"].append(vP)
1151
+ results_container["vS"].append(vS)
1152
+ results_container["vP/vS"].append(vPvS)
1153
+ results_container["K"].append(bulk_mod)
1154
+ results_container["G"].append(shear_mod)
1155
+ results_container["E"].append(youngs_mod)
1156
+ results_container["nu"].append(poisson_rat)
1157
+ results_container["GR"].append(gamma_ray)
1158
+ results_container["PE"].append(photoelectricity)
1159
+
1160
+ n += 1
1161
+
1162
+ return results_container
1163
+
1164
+ def create_greenschist_basaltic_alt(self, number=1, composition=None):
1165
+ results_container = {}
1166
+ results_container["rock"] = "Greenschist"
1167
+ results_container["mineralogy"] = {}
1168
+ results_container["chemistry"] = {}
1169
+ results_container["compounds"] = {}
1170
+ results_container["phi"] = []
1171
+ results_container["fluid"] = self.fluid
1172
+ results_container["rho_s"] = []
1173
+ results_container["rho"] = []
1174
+ results_container["vP"] = []
1175
+ results_container["vS"] = []
1176
+ results_container["vP/vS"] = []
1177
+ results_container["K"] = []
1178
+ results_container["G"] = []
1179
+ results_container["E"] = []
1180
+ results_container["nu"] = []
1181
+ results_container["GR"] = []
1182
+ results_container["PE"] = []
1183
+
1184
+ n = 0
1185
+ while n < number:
1186
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
1187
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1188
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1189
+ data_apatite = Phosphates(data_type=True).create_aptite()
1190
+
1191
+ mineralogy = {"Chl": data_chlorite, "Act": data_actinolite, "Pl": data_plagioclase, "Ep": self.data_epidote,
1192
+ "Ap": data_apatite}
1193
+
1194
+ minerals_list = list(mineralogy.keys())
1195
+
1196
+ if minerals_list[0] not in results_container["mineralogy"]:
1197
+ for mineral in minerals_list:
1198
+ results_container["mineralogy"][mineral] = []
1199
+
1200
+ if self.porosity == None:
1201
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
1202
+ else:
1203
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1204
+
1205
+ condition = False
1206
+
1207
+ while condition == False:
1208
+ elements_list = []
1209
+ phi_minerals = {}
1210
+ w_minerals = {}
1211
+ w_elements = {}
1212
+
1213
+ if composition != None:
1214
+ phi_chl = composition["Chl"]
1215
+ phi_act = composition["Act"]
1216
+ phi_pl = composition["Pl"]
1217
+ phi_ep = composition["Ep"]
1218
+ phi_ap = composition["Ap"]
1219
+
1220
+ phi_minerals["Chl"] = phi_chl
1221
+ phi_minerals["Act"] = phi_act
1222
+ phi_minerals["Pl"] = phi_pl
1223
+ phi_minerals["Ep"] = phi_ep
1224
+ phi_minerals["Ap"] = phi_ap
1225
+ else:
1226
+ condition_2 = False
1227
+ while condition_2 == False:
1228
+ phi_act = round(rd.uniform(0.20, 0.30), 4)
1229
+ phi_chl = round(rd.uniform(0.25, (1.0 - phi_act)), 4)
1230
+ phi_pl = round(rd.uniform(0.2, (1.0 - phi_act - phi_chl)), 4)
1231
+ phi_ep = round(rd.uniform(0.05, (1.0 - phi_act - phi_chl - phi_pl)), 4)
1232
+ phi_ap = round(1 - phi_act - phi_chl - phi_pl - phi_ep, 4)
1233
+ phi_total = phi_act + phi_chl + phi_pl + phi_ep + phi_ap
1234
+
1235
+ if np.isclose(phi_total, 1.0000) == True:
1236
+ if 0.2 <= phi_act <= 0.3 and 0.25 <= phi_chl <= 0.5 and 0.2 <= phi_pl <= 0.55 \
1237
+ and 0.0 <= phi_ep <= 0.15 and 0.0 <= phi_ap <= 0.1:
1238
+ condition_2 = True
1239
+
1240
+ phi_minerals["Chl"] = phi_chl
1241
+ phi_minerals["Act"] = phi_act
1242
+ phi_minerals["Pl"] = phi_pl
1243
+ phi_minerals["Ep"] = phi_ep
1244
+ phi_minerals["Ap"] = phi_ap
1245
+
1246
+ rho_s = 0
1247
+ velocities_minerals = {}
1248
+ for key, value in phi_minerals.items():
1249
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1250
+
1251
+ velocities_minerals[key] = {}
1252
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1253
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1254
+
1255
+ for element, value in mineralogy[key]["chemistry"].items():
1256
+ if element not in elements_list:
1257
+ elements_list.append(element)
1258
+ w_elements[element] = 0.0
1259
+
1260
+ if elements_list[0] not in results_container["chemistry"]:
1261
+ for element in elements_list:
1262
+ results_container["chemistry"][element] = []
1263
+
1264
+ rho_s = round(rho_s, 3)
1265
+
1266
+ for key, value in phi_minerals.items():
1267
+ if key == "Urn":
1268
+ n_digits = 4
1269
+ else:
1270
+ n_digits = 4
1271
+
1272
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1273
+
1274
+ if self.fluid == "water":
1275
+ data_fluid = self.data_water
1276
+ elif self.fluid == "oil":
1277
+ data_fluid = self.data_oil
1278
+ elif self.fluid == "gas":
1279
+ data_fluid = self.data_gas
1280
+
1281
+ old_index = elements_list.index("O")
1282
+ elements_list += [elements_list.pop(old_index)]
1283
+
1284
+ w_elements_total = 0.0
1285
+ for element in elements_list:
1286
+ if element != "O":
1287
+ for mineral, w_mineral in w_minerals.items():
1288
+ if element in mineralogy[mineral]["chemistry"]:
1289
+ if element == "U":
1290
+ n_digits = 4
1291
+ else:
1292
+ n_digits = 4
1293
+
1294
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1295
+ w_elements[element] += value
1296
+ w_elements_total += value
1297
+
1298
+ w_elements[element] = round(w_elements[element], n_digits)
1299
+ elif element == "O":
1300
+ w_elements[element] += round(1 - w_elements_total, 4)
1301
+ w_elements[element] = round(w_elements[element], 4)
1302
+
1303
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1304
+ total_w_elements = round(sum(w_elements.values()), 4)
1305
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
1306
+ for key, value in w_minerals.items():
1307
+ w_minerals[key] = abs(value)
1308
+
1309
+ for key, value in w_elements.items():
1310
+ w_elements[key] = abs(value)
1311
+
1312
+ condition = True
1313
+
1314
+ gamma_ray = 0.0
1315
+ photoelectricity = 0.0
1316
+
1317
+ K_list = []
1318
+ G_list = []
1319
+ bulk_mod = 0
1320
+ shear_mod = 0
1321
+ phi_list = []
1322
+ for key, value in phi_minerals.items():
1323
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1324
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1325
+
1326
+ gamma_ray = round(gamma_ray, 3)
1327
+ photoelectricity = round(photoelectricity, 3)
1328
+
1329
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1330
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1331
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1332
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1333
+ phi_list.append(phi_minerals[key])
1334
+
1335
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1336
+ bulk_mod = round(bulk_mod, 3)
1337
+ shear_mod = round(shear_mod, 3)
1338
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1339
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1340
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1341
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1342
+ vPvS = round(vP/vS, 3)
1343
+
1344
+ ## RESULTS
1345
+ for key, value in w_minerals.items():
1346
+ results_container["mineralogy"][key].append(value)
1347
+
1348
+ amounts = []
1349
+ for key, value in w_elements.items():
1350
+ results_container["chemistry"][key].append(value)
1351
+ chem_data = PeriodicSystem(name=key).get_data()
1352
+ amounts.append([key, chem_data[1], value])
1353
+
1354
+ list_elements = list(w_elements.keys())
1355
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1356
+ composition_oxides = {}
1357
+
1358
+ for var_oxide in list_oxides:
1359
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1360
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1361
+
1362
+ if list_oxides[0] not in results_container["compounds"]:
1363
+ for oxide in list_oxides:
1364
+ results_container["compounds"][oxide] = []
1365
+
1366
+ for key, value in composition_oxides.items():
1367
+ results_container["compounds"][key].append(value)
1368
+
1369
+ results_container["mineralogy"] = dict(sorted(
1370
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1371
+ results_container["chemistry"] = dict(sorted(
1372
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1373
+ results_container["compounds"] = dict(sorted(
1374
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1375
+
1376
+ results_container["phi"].append(phi_helper)
1377
+ results_container["rho_s"].append(rho_s)
1378
+ results_container["rho"].append(rho)
1379
+ results_container["vP"].append(vP)
1380
+ results_container["vS"].append(vS)
1381
+ results_container["vP/vS"].append(vPvS)
1382
+ results_container["K"].append(bulk_mod)
1383
+ results_container["G"].append(shear_mod)
1384
+ results_container["E"].append(youngs_mod)
1385
+ results_container["nu"].append(poisson_rat)
1386
+ results_container["GR"].append(gamma_ray)
1387
+ results_container["PE"].append(photoelectricity)
1388
+
1389
+ n += 1
1390
+
1391
+ return results_container
1392
+
1393
+ def create_greenschist_ultramafic_alt(self, number=1, composition=None):
1394
+ results_container = {}
1395
+ results_container["rock"] = "Greenschist"
1396
+ results_container["mineralogy"] = {}
1397
+ results_container["chemistry"] = {}
1398
+ results_container["compounds"] = {}
1399
+ results_container["phi"] = []
1400
+ results_container["fluid"] = self.fluid
1401
+ results_container["rho_s"] = []
1402
+ results_container["rho"] = []
1403
+ results_container["vP"] = []
1404
+ results_container["vS"] = []
1405
+ results_container["vP/vS"] = []
1406
+ results_container["K"] = []
1407
+ results_container["G"] = []
1408
+ results_container["E"] = []
1409
+ results_container["nu"] = []
1410
+ results_container["GR"] = []
1411
+ results_container["PE"] = []
1412
+
1413
+ n = 0
1414
+ while n < number:
1415
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1416
+ data_apatite = Phosphates(data_type=True).create_aptite()
1417
+
1418
+ mineralogy = {"Chl": data_chlorite, "Ctl": self.data_chrysotile, "Tlc": self.data_talc,
1419
+ "Tr": self.data_tremolite, "Di": self.data_diopside, "Bru": self.data_brucite,
1420
+ "Ap": data_apatite}
1421
+
1422
+ minerals_list = list(mineralogy.keys())
1423
+
1424
+ if minerals_list[0] not in results_container["mineralogy"]:
1425
+ for mineral in minerals_list:
1426
+ results_container["mineralogy"][mineral] = []
1427
+
1428
+ if self.porosity == None:
1429
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
1430
+ else:
1431
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1432
+
1433
+ condition = False
1434
+
1435
+ while condition == False:
1436
+ elements_list = []
1437
+ phi_minerals = {}
1438
+ w_minerals = {}
1439
+ w_elements = {}
1440
+
1441
+ if composition != None:
1442
+ phi_chl = composition["Chl"]
1443
+ phi_ctl = composition["Ctl"]
1444
+ phi_tlc = composition["Tlc"]
1445
+ phi_tr = composition["Tr"]
1446
+ phi_di = composition["Di"]
1447
+ phi_bru = composition["Bru"]
1448
+ phi_ap = composition["Ap"]
1449
+
1450
+ phi_minerals["Chl"] = phi_chl
1451
+ phi_minerals["Ctl"] = phi_ctl
1452
+ phi_minerals["Tlc"] = phi_tlc
1453
+ phi_minerals["Tr"] = phi_tr
1454
+ phi_minerals["Di"] = phi_di
1455
+ phi_minerals["Bru"] = phi_bru
1456
+ phi_minerals["Ap"] = phi_ap
1457
+ else:
1458
+ condition_2 = False
1459
+
1460
+ while condition_2 == False:
1461
+ phi_chl = round(rd.uniform(0.25, 0.50), 4)
1462
+ phi_ctl = round(rd.uniform(0.25, (1.0 - phi_chl)), 4)
1463
+ phi_tlc = round(rd.uniform(0.15, (1.0 - phi_chl - phi_ctl)), 4)
1464
+ phi_tr = round(rd.uniform(0.1, (1.0 - phi_chl - phi_ctl - phi_tlc)), 4)
1465
+ phi_di = round(rd.uniform(0.0, (1.0 - phi_chl - phi_ctl - phi_tlc - phi_tr)), 4)
1466
+ phi_bru = round(rd.uniform(0.0, (1.0 - phi_chl - phi_ctl - phi_tlc - phi_tr - phi_di)), 4)
1467
+ phi_ap = round(1 - phi_chl - phi_ctl - phi_tlc - phi_tr - phi_di - phi_bru, 4)
1468
+ phi_total = phi_chl + phi_ctl + phi_tlc + phi_tr + phi_di + phi_bru + phi_ap
1469
+
1470
+ if np.isclose(phi_total, 1.0000) == True:
1471
+ if (0.25 <= phi_chl <= 0.5 and 0.25 <= phi_ctl <= 0.5 and 0.15 <= phi_tlc <= 0.2 \
1472
+ and 0.1 <= phi_tr <= 0.2 and 0.0 <= phi_di <= 0.05 and 0.0 <= phi_bru <= 0.05
1473
+ and 0.0 <= phi_ap <= 0.05):
1474
+ condition_2 = True
1475
+
1476
+ phi_minerals["Chl"] = phi_chl
1477
+ phi_minerals["Ctl"] = phi_ctl
1478
+ phi_minerals["Tlc"] = phi_tlc
1479
+ phi_minerals["Tr"] = phi_tr
1480
+ phi_minerals["Di"] = phi_di
1481
+ phi_minerals["Bru"] = phi_bru
1482
+ phi_minerals["Ap"] = phi_ap
1483
+
1484
+ rho_s = 0
1485
+ velocities_minerals = {}
1486
+ for key, value in phi_minerals.items():
1487
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1488
+
1489
+ velocities_minerals[key] = {}
1490
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1491
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1492
+
1493
+ for element, value in mineralogy[key]["chemistry"].items():
1494
+ if element not in elements_list:
1495
+ elements_list.append(element)
1496
+ w_elements[element] = 0.0
1497
+
1498
+ if elements_list[0] not in results_container["chemistry"]:
1499
+ for element in elements_list:
1500
+ results_container["chemistry"][element] = []
1501
+
1502
+ rho_s = round(rho_s, 3)
1503
+
1504
+ n_minerals = len(minerals_list)
1505
+ w_minerals_total = 0
1506
+ for index, (key, value) in enumerate(phi_minerals.items()):
1507
+ if key == "Urn":
1508
+ n_digits = 4
1509
+ else:
1510
+ n_digits = 4
1511
+
1512
+ if index < n_minerals - 1:
1513
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1514
+ w_minerals[key] = result
1515
+ w_minerals_total += result
1516
+ else:
1517
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
1518
+
1519
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1520
+
1521
+ if self.fluid == "water":
1522
+ data_fluid = self.data_water
1523
+
1524
+ old_index = elements_list.index("O")
1525
+ elements_list += [elements_list.pop(old_index)]
1526
+
1527
+ w_elements_total = 0.0
1528
+ for element in elements_list:
1529
+ if element != "O":
1530
+ for mineral, w_mineral in w_minerals.items():
1531
+ if element in mineralogy[mineral]["chemistry"]:
1532
+ if element == "U":
1533
+ n_digits = 4
1534
+ else:
1535
+ n_digits = 4
1536
+
1537
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1538
+ w_elements[element] += value
1539
+ w_elements_total += value
1540
+
1541
+ w_elements[element] = round(w_elements[element], n_digits)
1542
+
1543
+ elif element == "O":
1544
+ w_elements[element] += round(1 - w_elements_total, 4)
1545
+ w_elements[element] = round(w_elements[element], 4)
1546
+
1547
+ total_w_elements = round(sum(w_elements.values()), 4)
1548
+
1549
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
1550
+ for key, value in w_minerals.items():
1551
+ w_minerals[key] = abs(value)
1552
+
1553
+ for key, value in w_elements.items():
1554
+ w_elements[key] = abs(value)
1555
+
1556
+ condition = True
1557
+
1558
+ gamma_ray = 0.0
1559
+ photoelectricity = 0.0
1560
+
1561
+ K_list = []
1562
+ G_list = []
1563
+ bulk_mod = 0
1564
+ shear_mod = 0
1565
+ phi_list = []
1566
+ for key, value in phi_minerals.items():
1567
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1568
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1569
+
1570
+ gamma_ray = round(gamma_ray, 3)
1571
+ photoelectricity = round(photoelectricity, 3)
1572
+
1573
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1574
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1575
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1576
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1577
+ phi_list.append(phi_minerals[key])
1578
+
1579
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1580
+ bulk_mod = round(bulk_mod, 3)
1581
+ shear_mod = round(shear_mod, 3)
1582
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1583
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1584
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1585
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1586
+ vPvS = round(vP/vS, 3)
1587
+
1588
+ ## RESULTS
1589
+ for key, value in w_minerals.items():
1590
+ results_container["mineralogy"][key].append(value)
1591
+
1592
+ amounts = []
1593
+ for key, value in w_elements.items():
1594
+ results_container["chemistry"][key].append(value)
1595
+ chem_data = PeriodicSystem(name=key).get_data()
1596
+ amounts.append([key, chem_data[1], value])
1597
+
1598
+ list_elements = list(w_elements.keys())
1599
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1600
+ composition_oxides = {}
1601
+
1602
+ for var_oxide in list_oxides:
1603
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1604
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1605
+
1606
+ if list_oxides[0] not in results_container["compounds"]:
1607
+ for oxide in list_oxides:
1608
+ results_container["compounds"][oxide] = []
1609
+
1610
+ for key, value in composition_oxides.items():
1611
+ results_container["compounds"][key].append(value)
1612
+
1613
+ results_container["mineralogy"] = dict(sorted(
1614
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1615
+ results_container["chemistry"] = dict(sorted(
1616
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1617
+ results_container["compounds"] = dict(sorted(
1618
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1619
+
1620
+ results_container["phi"].append(phi_helper)
1621
+ results_container["rho_s"].append(rho_s)
1622
+ results_container["rho"].append(rho)
1623
+ results_container["vP"].append(vP)
1624
+ results_container["vS"].append(vS)
1625
+ results_container["vP/vS"].append(vPvS)
1626
+ results_container["K"].append(bulk_mod)
1627
+ results_container["G"].append(shear_mod)
1628
+ results_container["E"].append(youngs_mod)
1629
+ results_container["nu"].append(poisson_rat)
1630
+ results_container["GR"].append(gamma_ray)
1631
+ results_container["PE"].append(photoelectricity)
1632
+
1633
+ n += 1
1634
+
1635
+ return results_container
1636
+
1637
+ def create_greenschist_pelitic_alt(self, number=1, composition=None):
1638
+ results_container = {}
1639
+ results_container["rock"] = "Greenschist"
1640
+ results_container["mineralogy"] = {}
1641
+ results_container["chemistry"] = {}
1642
+ results_container["compounds"] = {}
1643
+ results_container["phi"] = []
1644
+ results_container["fluid"] = self.fluid
1645
+ results_container["rho_s"] = []
1646
+ results_container["rho"] = []
1647
+ results_container["vP"] = []
1648
+ results_container["vS"] = []
1649
+ results_container["vP/vS"] = []
1650
+ results_container["K"] = []
1651
+ results_container["G"] = []
1652
+ results_container["E"] = []
1653
+ results_container["nu"] = []
1654
+ results_container["GR"] = []
1655
+ results_container["PE"] = []
1656
+
1657
+ n = 0
1658
+ while n < number:
1659
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1660
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1661
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1662
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1663
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
1664
+ data_apatite = Phosphates(data_type=True).create_aptite()
1665
+
1666
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
1667
+ "Chl": data_chlorite, "Ms": data_muscovite, "Grt": data_garnet_al,
1668
+ "Prl": self.data_pyrophyllite, "Ap": data_apatite}
1669
+
1670
+ minerals_list = list(mineralogy.keys())
1671
+
1672
+ if minerals_list[0] not in results_container["mineralogy"]:
1673
+ for mineral in minerals_list:
1674
+ results_container["mineralogy"][mineral] = []
1675
+
1676
+ if self.porosity == None:
1677
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
1678
+ else:
1679
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1680
+
1681
+ condition = False
1682
+
1683
+ while condition == False:
1684
+ elements_list = []
1685
+ phi_minerals = {}
1686
+ w_minerals = {}
1687
+ w_elements = {}
1688
+
1689
+ if composition != None:
1690
+ phi_qz = composition["Qz"]
1691
+ phi_kfs = composition["Kfs"]
1692
+ phi_pl = composition["Pl"]
1693
+ phi_chl = composition["Chl"]
1694
+ phi_ms = composition["Ms"]
1695
+ phi_grt = composition["Grt"]
1696
+ phi_prl = composition["Prl"]
1697
+ phi_ap = composition["Ap"]
1698
+
1699
+ phi_minerals["Qz"] = phi_qz
1700
+ phi_minerals["Kfs"] = phi_kfs
1701
+ phi_minerals["Pl"] = phi_pl
1702
+ phi_minerals["Chl"] = phi_chl
1703
+ phi_minerals["Ms"] = phi_ms
1704
+ phi_minerals["Grt"] = phi_grt
1705
+ phi_minerals["Prl"] = phi_prl
1706
+ phi_minerals["Ap"] = phi_ap
1707
+ else:
1708
+ condition_2 = False
1709
+
1710
+ while condition_2 == False:
1711
+ phi_qz = round(rd.uniform(0.25, 0.7), 4)
1712
+ phi_chl = round(rd.uniform(0.15, (1.0 - phi_qz)), 4)
1713
+ phi_kfs = round(rd.uniform(0.05, (1.0 - phi_qz - phi_chl)), 4)
1714
+ phi_pl = round(rd.uniform(0.05, (1.0 - phi_qz - phi_chl - phi_kfs)), 4)
1715
+ phi_ms = round(rd.uniform(0.0, (1.0 - phi_qz - phi_chl - phi_kfs - phi_pl)), 4)
1716
+ phi_grt = round(rd.uniform(0.0, (1.0 - phi_qz - phi_chl - phi_kfs - phi_pl - phi_ms)), 4)
1717
+ phi_prl = round(rd.uniform(
1718
+ 0.0, (1.0 - phi_qz - phi_chl - phi_kfs - phi_pl - phi_ms - phi_grt)), 4)
1719
+ phi_ap = round(1 - phi_qz - phi_chl - phi_kfs - phi_pl - phi_ms - phi_grt - phi_prl, 4)
1720
+ phi_total = phi_qz + phi_chl + phi_kfs + phi_pl + phi_ms + phi_grt + phi_prl + phi_ap
1721
+
1722
+ if np.isclose(phi_total, 1.0000) == True:
1723
+ if 0.25 <= phi_qz <= 0.7 and 0.15 <= phi_chl <= 0.3 and 0.05 <= phi_kfs <= 0.15 \
1724
+ and 0.05 <= phi_pl <= 0.15 and 0.0 <= phi_ms <= 0.1 and 0.0 <= phi_grt <= 0.05 \
1725
+ and 0.0 <= phi_prl <= 0.05 and 0.0 <= phi_ap <= 0.05:
1726
+ condition_2 = True
1727
+
1728
+ phi_minerals["Qz"] = phi_qz
1729
+ phi_minerals["Kfs"] = phi_kfs
1730
+ phi_minerals["Pl"] = phi_pl
1731
+ phi_minerals["Chl"] = phi_chl
1732
+ phi_minerals["Ms"] = phi_ms
1733
+ phi_minerals["Grt"] = phi_grt
1734
+ phi_minerals["Prl"] = phi_prl
1735
+ phi_minerals["Ap"] = phi_ap
1736
+
1737
+ rho_s = 0
1738
+ velocities_minerals = {}
1739
+ for key, value in phi_minerals.items():
1740
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1741
+
1742
+ velocities_minerals[key] = {}
1743
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1744
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1745
+
1746
+ for element, value in mineralogy[key]["chemistry"].items():
1747
+ if element not in elements_list:
1748
+ elements_list.append(element)
1749
+ w_elements[element] = 0.0
1750
+
1751
+ if elements_list[0] not in results_container["chemistry"]:
1752
+ for element in elements_list:
1753
+ results_container["chemistry"][element] = []
1754
+
1755
+ rho_s = round(rho_s, 3)
1756
+
1757
+ n_minerals = len(minerals_list)
1758
+ w_minerals_total = 0
1759
+ for index, (key, value) in enumerate(phi_minerals.items()):
1760
+ if key == "Urn":
1761
+ n_digits = 4
1762
+ else:
1763
+ n_digits = 4
1764
+
1765
+ if index < n_minerals - 1:
1766
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1767
+ w_minerals[key] = result
1768
+ w_minerals_total += result
1769
+ else:
1770
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
1771
+
1772
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1773
+
1774
+ if self.fluid == "water":
1775
+ data_fluid = self.data_water
1776
+
1777
+ old_index = elements_list.index("O")
1778
+ elements_list += [elements_list.pop(old_index)]
1779
+
1780
+ w_elements_total = 0.0
1781
+ for element in elements_list:
1782
+ if element != "O":
1783
+ for mineral, w_mineral in w_minerals.items():
1784
+ if element in mineralogy[mineral]["chemistry"]:
1785
+ if element == "U":
1786
+ n_digits = 4
1787
+ else:
1788
+ n_digits = 4
1789
+
1790
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1791
+ w_elements[element] += value
1792
+ w_elements_total += value
1793
+
1794
+ w_elements[element] = round(w_elements[element], n_digits)
1795
+
1796
+ elif element == "O":
1797
+ w_elements[element] += round(1 - w_elements_total, 4)
1798
+ w_elements[element] = round(w_elements[element], 4)
1799
+
1800
+ total_w_elements = round(sum(w_elements.values()), 4)
1801
+
1802
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
1803
+ for key, value in w_minerals.items():
1804
+ w_minerals[key] = abs(value)
1805
+
1806
+ for key, value in w_elements.items():
1807
+ w_elements[key] = abs(value)
1808
+
1809
+ condition = True
1810
+
1811
+ gamma_ray = 0.0
1812
+ photoelectricity = 0.0
1813
+
1814
+ K_list = []
1815
+ G_list = []
1816
+ bulk_mod = 0
1817
+ shear_mod = 0
1818
+ phi_list = []
1819
+ for key, value in phi_minerals.items():
1820
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1821
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1822
+
1823
+ gamma_ray = round(gamma_ray, 3)
1824
+ photoelectricity = round(photoelectricity, 3)
1825
+
1826
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1827
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1828
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1829
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1830
+ phi_list.append(phi_minerals[key])
1831
+
1832
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1833
+ bulk_mod = round(bulk_mod, 3)
1834
+ shear_mod = round(shear_mod, 3)
1835
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1836
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1837
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1838
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1839
+ vPvS = round(vP/vS, 3)
1840
+
1841
+ ## RESULTS
1842
+ for key, value in w_minerals.items():
1843
+ results_container["mineralogy"][key].append(value)
1844
+
1845
+ amounts = []
1846
+ for key, value in w_elements.items():
1847
+ results_container["chemistry"][key].append(value)
1848
+ chem_data = PeriodicSystem(name=key).get_data()
1849
+ amounts.append([key, chem_data[1], value])
1850
+
1851
+ list_elements = list(w_elements.keys())
1852
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1853
+ composition_oxides = {}
1854
+
1855
+ for var_oxide in list_oxides:
1856
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1857
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1858
+
1859
+ if list_oxides[0] not in results_container["compounds"]:
1860
+ for oxide in list_oxides:
1861
+ results_container["compounds"][oxide] = []
1862
+
1863
+ for key, value in composition_oxides.items():
1864
+ results_container["compounds"][key].append(value)
1865
+
1866
+ results_container["mineralogy"] = dict(sorted(
1867
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1868
+ results_container["chemistry"] = dict(sorted(
1869
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1870
+ results_container["compounds"] = dict(sorted(
1871
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1872
+
1873
+ results_container["phi"].append(phi_helper)
1874
+ results_container["rho_s"].append(rho_s)
1875
+ results_container["rho"].append(rho)
1876
+ results_container["vP"].append(vP)
1877
+ results_container["vS"].append(vS)
1878
+ results_container["vP/vS"].append(vPvS)
1879
+ results_container["K"].append(bulk_mod)
1880
+ results_container["G"].append(shear_mod)
1881
+ results_container["E"].append(youngs_mod)
1882
+ results_container["nu"].append(poisson_rat)
1883
+ results_container["GR"].append(gamma_ray)
1884
+ results_container["PE"].append(photoelectricity)
1885
+
1886
+ n += 1
1887
+
1888
+ return results_container
1889
+
1890
+ def create_greenschist(self, number, porosity=None):
1891
+ #
1892
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1893
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
1894
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
1895
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1896
+ self.data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1897
+ self.data_antigorite = Phyllosilicates(impurity="pure", data_type=True).create_antigorite()
1898
+ #
1899
+ assemblage = [self.data_quartz, self.data_plagioclase, self.data_chlorite, self.data_antigorite,
1900
+ self.data_epidote, self.data_muscovite]
1901
+ #
1902
+ amounts_mineralogy = {}
1903
+ amounts_chemistry = {}
1904
+ bulk_properties = {}
1905
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
1906
+ for property in properties:
1907
+ bulk_properties[property] = []
1908
+ mineral_list = []
1909
+ elements = []
1910
+ for mineral in assemblage:
1911
+ amounts_mineralogy[mineral["mineral"]] = []
1912
+ mineral_list.append(mineral["mineral"])
1913
+ elements_mineral = list(mineral["chemistry"].keys())
1914
+ for element in elements_mineral:
1915
+ if element not in elements:
1916
+ elements.append(element)
1917
+ amounts_chemistry[element] = []
1918
+ mineral_list.sort()
1919
+ elements.sort()
1920
+ #
1921
+ n = 0
1922
+ amounts_helper = []
1923
+ while n < number:
1924
+ w_total = 0
1925
+ n_minerals = 0
1926
+ for mineral in mineral_list:
1927
+ if mineral == "Qz":
1928
+ if n_minerals < len(mineral_list)-1:
1929
+ value = round(1-w_total, 4)
1930
+ else:
1931
+ value = round(1-w_total, 4)
1932
+ if value >= 0.0 and 0.05 <= value <= 0.25:
1933
+ amounts_helper.append(value)
1934
+ w_total += value
1935
+ n_minerals += 1
1936
+ elif mineral == "Pl":
1937
+ if n_minerals < len(mineral_list)-1:
1938
+ value = round(rd.uniform(0.20, 0.50), 4)
1939
+ else:
1940
+ value = round(1-w_total, 4)
1941
+ if value >= 0.0 and 0.20 <= value <= 0.50:
1942
+ amounts_helper.append(value)
1943
+ w_total += value
1944
+ n_minerals += 1
1945
+ elif mineral == "Chl":
1946
+ if n_minerals < len(mineral_list)-1:
1947
+ value = round(rd.uniform(0.15, 0.30), 4)
1948
+ else:
1949
+ value = round(1-w_total, 4)
1950
+ if value >= 0.0 and 0.10 <= value <= 0.25:
1951
+ amounts_helper.append(value)
1952
+ w_total += value
1953
+ n_minerals += 1
1954
+ elif mineral == "Ant":
1955
+ if n_minerals < len(mineral_list)-1:
1956
+ value = round(rd.uniform(0.05, 0.20), 4)
1957
+ else:
1958
+ value = round(1-w_total, 4)
1959
+ if value >= 0.0 and 0.05 <= value <= 0.20:
1960
+ amounts_helper.append(value)
1961
+ w_total += value
1962
+ n_minerals += 1
1963
+ elif mineral == "Ep":
1964
+ if n_minerals < len(mineral_list)-1:
1965
+ value = round(rd.uniform(0.05, 0.20), 4)
1966
+ else:
1967
+ value = round(1-w_total, 4)
1968
+ if value >= 0.0 and 0.05 <= value <= 0.20:
1969
+ amounts_helper.append(value)
1970
+ w_total += value
1971
+ n_minerals += 1
1972
+ elif mineral == "Ms":
1973
+ if n_minerals < len(mineral_list)-1:
1974
+ value = round(rd.uniform(0.0, 0.05), 4)
1975
+ else:
1976
+ value = round(1-w_total, 4)
1977
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1978
+ amounts_helper.append(value)
1979
+ w_total += value
1980
+ n_minerals += 1
1981
+ #
1982
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
1983
+ for index, mineral in enumerate(mineral_list):
1984
+ amounts_mineralogy[mineral].append(amounts_helper[index])
1985
+ n += 1
1986
+ amounts_helper.clear()
1987
+ else:
1988
+ n += 0
1989
+ amounts_helper.clear()
1990
+ #
1991
+ n = 0
1992
+ amounts_helper = {}
1993
+ while n < number:
1994
+ w_total = 0
1995
+ n_elements = 0
1996
+ rho_s_helper = 0
1997
+ bulkmod_helper = 0
1998
+ shearmod_helper = 0
1999
+ gr_helper = 0
2000
+ pe_helper = 0
2001
+ if porosity == None:
2002
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
2003
+ else:
2004
+ phi_helper = porosity
2005
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
2006
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2007
+ self.data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
2008
+ for element in elements:
2009
+ amounts_helper[element] = 0
2010
+ if element in self.data_quartz["chemistry"]:
2011
+ if n_elements < len(elements)-1:
2012
+ value = round(amounts_mineralogy["Qz"][n]*self.data_quartz["chemistry"][element], 4)
2013
+ else:
2014
+ value = round(1-w_total, 4)
2015
+ amounts_helper[element] += value
2016
+ w_total += value
2017
+ if element in self.data_plagioclase["chemistry"]:
2018
+ if n_elements < len(elements)-1:
2019
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
2020
+ else:
2021
+ value = round(1-w_total, 4)
2022
+ amounts_helper[element] += value
2023
+ w_total += value
2024
+ if element in self.data_chlorite["chemistry"]:
2025
+ if n_elements < len(elements)-1:
2026
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
2027
+ else:
2028
+ value = round(1-w_total, 4)
2029
+ amounts_helper[element] += value
2030
+ w_total += value
2031
+ if element in self.data_antigorite["chemistry"]:
2032
+ if n_elements < len(elements)-1:
2033
+ value = round(amounts_mineralogy["Ant"][n]*self.data_antigorite["chemistry"][element], 4)
2034
+ else:
2035
+ value = round(1-w_total, 4)
2036
+ amounts_helper[element] += value
2037
+ w_total += value
2038
+ if element in self.data_muscovite["chemistry"]:
2039
+ if n_elements < len(elements)-1:
2040
+ value = round(amounts_mineralogy["Ms"][n]*self.data_muscovite["chemistry"][element], 4)
2041
+ else:
2042
+ value = round(1-w_total, 4)
2043
+ amounts_helper[element] += value
2044
+ w_total += value
2045
+ if element in self.data_epidote["chemistry"]:
2046
+ if n_elements < len(elements)-1:
2047
+ value = round(amounts_mineralogy["Ep"][n]*self.data_epidote["chemistry"][element], 4)
2048
+ else:
2049
+ value = round(1-w_total, 4)
2050
+ amounts_helper[element] += value
2051
+ w_total += value
2052
+ n_elements += 1
2053
+ if sum(amounts_helper.values()) == 1.0:
2054
+ for key, value in amounts_helper.items():
2055
+ amounts_chemistry[key].append(round(value, 4))
2056
+ for mineral in mineral_list:
2057
+ if mineral == "Qz":
2058
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["rho"], 3)
2059
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["K"], 3)
2060
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_quartz["G"], 3)
2061
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["GR"], 3)
2062
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["PE"], 3)
2063
+ elif mineral == "Pl":
2064
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
2065
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
2066
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
2067
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
2068
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
2069
+ elif mineral == "Chl":
2070
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
2071
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
2072
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
2073
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
2074
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
2075
+ elif mineral == "Ant":
2076
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["rho"], 3)
2077
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["K"], 3)
2078
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_antigorite["G"], 3)
2079
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["GR"], 3)
2080
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["PE"], 3)
2081
+ elif mineral == "Ep":
2082
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["rho"], 3)
2083
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["K"], 3)
2084
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_epidote["G"], 3)
2085
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["GR"], 3)
2086
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["PE"], 3)
2087
+ elif mineral == "Ms":
2088
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["rho"], 3)
2089
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["K"], 3)
2090
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_muscovite["G"], 3)
2091
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["GR"], 3)
2092
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["PE"], 3)
2093
+ #
2094
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2095
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2096
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2097
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2098
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2099
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2100
+ #
2101
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2102
+ bulk_properties["rho"].append(rho_helper)
2103
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2104
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2105
+ bulk_properties["E"].append(youngsmod_helper)
2106
+ bulk_properties["nu"].append(poisson_helper)
2107
+ bulk_properties["vP"].append(vP_helper)
2108
+ bulk_properties["vS"].append(vS_helper)
2109
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2110
+ bulk_properties["GR"].append(round(gr_helper, 3))
2111
+ bulk_properties["PE"].append(round(pe_helper, 3))
2112
+ bulk_properties["phi"].append(round(phi_helper, 3))
2113
+ n += 1
2114
+ #
2115
+ results = {}
2116
+ results["rock"] = "Greenschist"
2117
+ if number > 1:
2118
+ results["mineralogy"] = amounts_mineralogy
2119
+ results["chemistry"] = amounts_chemistry
2120
+ results["phi"] = bulk_properties["phi"]
2121
+ results["fluid"] = "water"
2122
+ results["rho_s"] = bulk_properties["rho_s"]
2123
+ results["rho"] = bulk_properties["rho"]
2124
+ results["vP"] = bulk_properties["vP"]
2125
+ results["vS"] = bulk_properties["vS"]
2126
+ results["vP/vS"] = bulk_properties["vPvS"]
2127
+ results["K"] = bulk_properties["K"]
2128
+ results["G"] = bulk_properties["G"]
2129
+ results["E"] = bulk_properties["E"]
2130
+ results["nu"] = bulk_properties["nu"]
2131
+ results["GR"] = bulk_properties["GR"]
2132
+ results["PE"] = bulk_properties["PE"]
2133
+ else:
2134
+ single_amounts_mineralogy = {}
2135
+ single_amounts_chemistry = {}
2136
+ for mineral, value in amounts_mineralogy.items():
2137
+ single_amounts_mineralogy[mineral] = value[0]
2138
+ for element, value in amounts_chemistry.items():
2139
+ single_amounts_chemistry[element] = value[0]
2140
+ results["mineralogy"] = single_amounts_mineralogy
2141
+ results["chemistry"] = single_amounts_chemistry
2142
+ results["phi"] = bulk_properties["phi"][0]
2143
+ results["fluid"] = "water"
2144
+ results["rho_s"] = bulk_properties["rho_s"][0]
2145
+ results["rho"] = bulk_properties["rho"][0]
2146
+ results["vP"] = bulk_properties["vP"][0]
2147
+ results["vS"] = bulk_properties["vS"][0]
2148
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2149
+ results["K"] = bulk_properties["K"][0]
2150
+ results["G"] = bulk_properties["G"][0]
2151
+ results["E"] = bulk_properties["E"][0]
2152
+ results["nu"] = bulk_properties["nu"][0]
2153
+ results["GR"] = bulk_properties["GR"][0]
2154
+ results["PE"] = bulk_properties["PE"][0]
2155
+ #
2156
+ return results
2157
+ #
2158
+ def create_greenschist_basaltic(self, number, porosity=None):
2159
+ #
2160
+ self.data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
2161
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2162
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
2163
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
2164
+ #
2165
+ assemblage = [self.data_chlorite, self.data_actinolite, self.data_plagioclase, self.data_epidote]
2166
+ #
2167
+ amounts_mineralogy = {}
2168
+ amounts_chemistry = {}
2169
+ bulk_properties = {}
2170
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
2171
+ for property in properties:
2172
+ bulk_properties[property] = []
2173
+ mineral_list = []
2174
+ elements = []
2175
+ for mineral in assemblage:
2176
+ amounts_mineralogy[mineral["mineral"]] = []
2177
+ mineral_list.append(mineral["mineral"])
2178
+ elements_mineral = list(mineral["chemistry"].keys())
2179
+ for element in elements_mineral:
2180
+ if element not in elements:
2181
+ elements.append(element)
2182
+ amounts_chemistry[element] = []
2183
+ mineral_list.sort()
2184
+ elements.sort()
2185
+ #
2186
+ n = 0
2187
+ amounts_helper = []
2188
+ while n < number:
2189
+ w_total = 0
2190
+ n_minerals = 0
2191
+ for mineral in mineral_list:
2192
+ if mineral == "Act":
2193
+ if n_minerals < len(mineral_list)-1:
2194
+ value = round(rd.uniform(0.20, 0.30), 4)
2195
+ else:
2196
+ value = round(1-w_total, 4)
2197
+ if value >= 0.0 and 0.20 <= value <= 0.30:
2198
+ amounts_helper.append(value)
2199
+ w_total += value
2200
+ n_minerals += 1
2201
+ elif mineral == "Chl":
2202
+ if n_minerals < len(mineral_list)-1:
2203
+ value = round(rd.uniform(0.25, 0.50), 4)
2204
+ else:
2205
+ value = round(1-w_total, 4)
2206
+ if value >= 0.0 and 0.25 <= value <= 0.50:
2207
+ amounts_helper.append(value)
2208
+ w_total += value
2209
+ n_minerals += 1
2210
+ elif mineral == "Ep":
2211
+ if n_minerals < len(mineral_list)-1:
2212
+ value = round(rd.uniform(0.0, 0.05), 4)
2213
+ else:
2214
+ value = round(1-w_total, 4)
2215
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2216
+ amounts_helper.append(value)
2217
+ w_total += value
2218
+ n_minerals += 1
2219
+ elif mineral == "Pl":
2220
+ if n_minerals < len(mineral_list)-1:
2221
+ value = round(1-w_total, 4)
2222
+ else:
2223
+ value = round(1-w_total, 4)
2224
+ if value >= 0.0 and 0.20 <= value <= 0.55:
2225
+ amounts_helper.append(value)
2226
+ w_total += value
2227
+ n_minerals += 1
2228
+ #
2229
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
2230
+ for index, mineral in enumerate(mineral_list):
2231
+ amounts_mineralogy[mineral].append(amounts_helper[index])
2232
+ n += 1
2233
+ amounts_helper.clear()
2234
+ else:
2235
+ n += 0
2236
+ amounts_helper.clear()
2237
+ #
2238
+ n = 0
2239
+ amounts_helper = {}
2240
+ while n < number:
2241
+ w_total = 0
2242
+ n_elements = 0
2243
+ rho_s_helper = 0
2244
+ bulkmod_helper = 0
2245
+ shearmod_helper = 0
2246
+ gr_helper = 0
2247
+ pe_helper = 0
2248
+ if porosity == None:
2249
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
2250
+ else:
2251
+ phi_helper = porosity
2252
+ #
2253
+ x = rd.uniform(0.9, 1.0)
2254
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(x_value=x)
2255
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2256
+ self.data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
2257
+ for element in elements:
2258
+ amounts_helper[element] = 0
2259
+ if element in self.data_actinolite["chemistry"]:
2260
+ if n_elements < len(elements)-1:
2261
+ value = round(amounts_mineralogy["Act"][n]*self.data_actinolite["chemistry"][element], 4)
2262
+ else:
2263
+ value = round(1-w_total, 4)
2264
+ amounts_helper[element] += value
2265
+ w_total += value
2266
+ if element in self.data_chlorite["chemistry"]:
2267
+ if n_elements < len(elements)-1:
2268
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
2269
+ else:
2270
+ value = round(1-w_total, 4)
2271
+ amounts_helper[element] += value
2272
+ w_total += value
2273
+ if element in self.data_epidote["chemistry"]:
2274
+ if n_elements < len(elements)-1:
2275
+ value = round(amounts_mineralogy["Ep"][n]*self.data_epidote["chemistry"][element], 4)
2276
+ else:
2277
+ value = round(1-w_total, 4)
2278
+ amounts_helper[element] += value
2279
+ w_total += value
2280
+ if element in self.data_plagioclase["chemistry"]:
2281
+ if n_elements < len(elements)-1:
2282
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
2283
+ else:
2284
+ value = round(1-w_total, 4)
2285
+ amounts_helper[element] += value
2286
+ w_total += value
2287
+ #
2288
+ n_elements += 1
2289
+ if sum(amounts_helper.values()) == 1.0:
2290
+ for key, value in amounts_helper.items():
2291
+ amounts_chemistry[key].append(round(value, 4))
2292
+ for mineral in mineral_list:
2293
+ if mineral == "Act":
2294
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["rho"], 3)
2295
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["K"], 3)
2296
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_actinolite["G"], 3)
2297
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["GR"], 3)
2298
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["PE"], 3)
2299
+ elif mineral == "Pl":
2300
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
2301
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
2302
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
2303
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
2304
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
2305
+ elif mineral == "Chl":
2306
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
2307
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
2308
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
2309
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
2310
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
2311
+ elif mineral == "Ep":
2312
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["rho"], 3)
2313
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["K"], 3)
2314
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_epidote["G"], 3)
2315
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["GR"], 3)
2316
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["PE"], 3)
2317
+ #
2318
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2319
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2320
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2321
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2322
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2323
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2324
+ #
2325
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2326
+ bulk_properties["rho"].append(rho_helper)
2327
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2328
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2329
+ bulk_properties["E"].append(youngsmod_helper)
2330
+ bulk_properties["nu"].append(poisson_helper)
2331
+ bulk_properties["vP"].append(vP_helper)
2332
+ bulk_properties["vS"].append(vS_helper)
2333
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2334
+ bulk_properties["GR"].append(round(gr_helper, 3))
2335
+ bulk_properties["PE"].append(round(pe_helper, 3))
2336
+ bulk_properties["phi"].append(round(phi_helper, 3))
2337
+ n += 1
2338
+ #
2339
+ results = {}
2340
+ results["rock"] = "Greenschist"
2341
+ if number > 1:
2342
+ results["mineralogy"] = amounts_mineralogy
2343
+ results["chemistry"] = amounts_chemistry
2344
+ results["phi"] = bulk_properties["phi"]
2345
+ results["fluid"] = "water"
2346
+ results["rho_s"] = bulk_properties["rho_s"]
2347
+ results["rho"] = bulk_properties["rho"]
2348
+ results["vP"] = bulk_properties["vP"]
2349
+ results["vS"] = bulk_properties["vS"]
2350
+ results["vP/vS"] = bulk_properties["vPvS"]
2351
+ results["K"] = bulk_properties["K"]
2352
+ results["G"] = bulk_properties["G"]
2353
+ results["E"] = bulk_properties["E"]
2354
+ results["nu"] = bulk_properties["nu"]
2355
+ results["GR"] = bulk_properties["GR"]
2356
+ results["PE"] = bulk_properties["PE"]
2357
+ else:
2358
+ single_amounts_mineralogy = {}
2359
+ single_amounts_chemistry = {}
2360
+ for mineral, value in amounts_mineralogy.items():
2361
+ single_amounts_mineralogy[mineral] = value[0]
2362
+ for element, value in amounts_chemistry.items():
2363
+ single_amounts_chemistry[element] = value[0]
2364
+ results["mineralogy"] = single_amounts_mineralogy
2365
+ results["chemistry"] = single_amounts_chemistry
2366
+ results["phi"] = bulk_properties["phi"][0]
2367
+ results["fluid"] = "water"
2368
+ results["rho_s"] = bulk_properties["rho_s"][0]
2369
+ results["rho"] = bulk_properties["rho"][0]
2370
+ results["vP"] = bulk_properties["vP"][0]
2371
+ results["vS"] = bulk_properties["vS"][0]
2372
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2373
+ results["K"] = bulk_properties["K"][0]
2374
+ results["G"] = bulk_properties["G"][0]
2375
+ results["E"] = bulk_properties["E"][0]
2376
+ results["nu"] = bulk_properties["nu"][0]
2377
+ results["GR"] = bulk_properties["GR"][0]
2378
+ results["PE"] = bulk_properties["PE"][0]
2379
+ #
2380
+ return results
2381
+ #
2382
+ def create_greenschist_ultramafic(self, number, porosity=None):
2383
+ #
2384
+ self.data_brucite = Oxides(impurity="pure", data_type=True).create_brucite()
2385
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2386
+ self.data_chrysotile = Phyllosilicates(impurity="pure", data_type=True).create_chrysotile()
2387
+ self.data_diopside = Inosilicates(impurity="pure", data_type=True).create_diopside()
2388
+ self.data_talc = Phyllosilicates(impurity="pure", data_type=True).create_talc()
2389
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
2390
+ #
2391
+ assemblage = [self.data_chlorite, self.data_chrysotile, self.data_talc, self.data_tremolite,
2392
+ self.data_diopside, self.data_brucite]
2393
+ #
2394
+ amounts_mineralogy = {}
2395
+ amounts_chemistry = {}
2396
+ bulk_properties = {}
2397
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
2398
+ for property in properties:
2399
+ bulk_properties[property] = []
2400
+ mineral_list = []
2401
+ elements = []
2402
+ for mineral in assemblage:
2403
+ amounts_mineralogy[mineral["mineral"]] = []
2404
+ mineral_list.append(mineral["mineral"])
2405
+ elements_mineral = list(mineral["chemistry"].keys())
2406
+ for element in elements_mineral:
2407
+ if element not in elements:
2408
+ elements.append(element)
2409
+ amounts_chemistry[element] = []
2410
+ mineral_list.sort()
2411
+ elements.sort()
2412
+ #
2413
+ n = 0
2414
+ amounts_helper = []
2415
+ while n < number:
2416
+ w_total = 0
2417
+ n_minerals = 0
2418
+ for mineral in mineral_list:
2419
+ if mineral == "Bru":
2420
+ if n_minerals < len(mineral_list)-1:
2421
+ value = round(rd.uniform(0.0, 0.05), 4) # Bru (0.0, 0.05), Chl (0.25, 0.50), Ctl (0.25, 0.50), Tlc (0.15, 0.20), Tr (0.10, 0.20), Di (0.0, 0.05)
2422
+ else:
2423
+ value = round(1-w_total, 4)
2424
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2425
+ amounts_helper.append(value)
2426
+ w_total += value
2427
+ n_minerals += 1
2428
+ elif mineral == "Chl":
2429
+ if n_minerals < len(mineral_list)-1:
2430
+ value = round(rd.uniform(0.25, 0.50), 4)
2431
+ else:
2432
+ value = round(1-w_total, 4)
2433
+ if value >= 0.0 and 0.25 <= value <= 0.50:
2434
+ amounts_helper.append(value)
2435
+ w_total += value
2436
+ n_minerals += 1
2437
+ elif mineral == "Ctl":
2438
+ if n_minerals < len(mineral_list)-1:
2439
+ value = round(rd.uniform(0.25, 0.50), 4)
2440
+ else:
2441
+ value = round(1-w_total, 4)
2442
+ if value >= 0.0 and 0.25 <= value <= 0.50:
2443
+ amounts_helper.append(value)
2444
+ w_total += value
2445
+ n_minerals += 1
2446
+ elif mineral == "Tlc":
2447
+ if n_minerals < len(mineral_list)-1:
2448
+ value = round(rd.uniform(0.15, 0.20), 4)
2449
+ else:
2450
+ value = round(1-w_total, 4)
2451
+ if value >= 0.0 and 0.15 <= value <= 0.20:
2452
+ amounts_helper.append(value)
2453
+ w_total += value
2454
+ n_minerals += 1
2455
+ elif mineral == "Tr":
2456
+ if n_minerals < len(mineral_list)-1:
2457
+ value = round(1-w_total, 4)
2458
+ else:
2459
+ value = round(1-w_total, 4)
2460
+ if value >= 0.0 and 0.10 <= value <= 0.20:
2461
+ amounts_helper.append(value)
2462
+ w_total += value
2463
+ n_minerals += 1
2464
+ elif mineral == "Di":
2465
+ if n_minerals < len(mineral_list)-1:
2466
+ value = round(rd.uniform(0.0, 0.05), 4)
2467
+ else:
2468
+ value = round(1-w_total, 4)
2469
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2470
+ amounts_helper.append(value)
2471
+ w_total += value
2472
+ n_minerals += 1
2473
+ #
2474
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
2475
+ for index, mineral in enumerate(mineral_list):
2476
+ amounts_mineralogy[mineral].append(amounts_helper[index])
2477
+ n += 1
2478
+ amounts_helper.clear()
2479
+ else:
2480
+ n += 0
2481
+ amounts_helper.clear()
2482
+ #
2483
+ n = 0
2484
+ amounts_helper = {}
2485
+ while n < number:
2486
+ w_total = 0
2487
+ n_elements = 0
2488
+ rho_s_helper = 0
2489
+ bulkmod_helper = 0
2490
+ shearmod_helper = 0
2491
+ gr_helper = 0
2492
+ pe_helper = 0
2493
+ if porosity == None:
2494
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
2495
+ else:
2496
+ phi_helper = porosity
2497
+ #
2498
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2499
+ #
2500
+ for element in elements:
2501
+ amounts_helper[element] = 0
2502
+ if element in self.data_brucite["chemistry"]:
2503
+ if n_elements < len(elements)-1:
2504
+ value = round(amounts_mineralogy["Bru"][n]*self.data_brucite["chemistry"][element], 4)
2505
+ else:
2506
+ value = round(1-w_total, 4)
2507
+ amounts_helper[element] += value
2508
+ w_total += value
2509
+ if element in self.data_chlorite["chemistry"]:
2510
+ if n_elements < len(elements)-1:
2511
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
2512
+ else:
2513
+ value = round(1-w_total, 4)
2514
+ amounts_helper[element] += value
2515
+ w_total += value
2516
+ if element in self.data_chrysotile["chemistry"]:
2517
+ if n_elements < len(elements)-1:
2518
+ value = round(amounts_mineralogy["Ctl"][n]*self.data_chrysotile["chemistry"][element], 4)
2519
+ else:
2520
+ value = round(1-w_total, 4)
2521
+ amounts_helper[element] += value
2522
+ w_total += value
2523
+ if element in self.data_diopside["chemistry"]:
2524
+ if n_elements < len(elements)-1:
2525
+ value = round(amounts_mineralogy["Di"][n]*self.data_diopside["chemistry"][element], 4)
2526
+ else:
2527
+ value = round(1-w_total, 4)
2528
+ amounts_helper[element] += value
2529
+ w_total += value
2530
+ if element in self.data_talc["chemistry"]:
2531
+ if n_elements < len(elements)-1:
2532
+ value = round(amounts_mineralogy["Tlc"][n]*self.data_talc["chemistry"][element], 4)
2533
+ else:
2534
+ value = round(1-w_total, 4)
2535
+ amounts_helper[element] += value
2536
+ w_total += value
2537
+ if element in self.data_tremolite["chemistry"]:
2538
+ if n_elements < len(elements)-1:
2539
+ value = round(amounts_mineralogy["Tr"][n]*self.data_tremolite["chemistry"][element], 4)
2540
+ else:
2541
+ value = round(1-w_total, 4)
2542
+ amounts_helper[element] += value
2543
+ w_total += value
2544
+ #
2545
+ n_elements += 1
2546
+ if sum(amounts_helper.values()) == 1.0:
2547
+ for key, value in amounts_helper.items():
2548
+ amounts_chemistry[key].append(round(value, 4))
2549
+ for mineral in mineral_list:
2550
+ if mineral == "Bru":
2551
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["rho"], 3)
2552
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["K"], 3)
2553
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_brucite["G"], 3)
2554
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["GR"], 3)
2555
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["PE"], 3)
2556
+ elif mineral == "Chl":
2557
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
2558
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
2559
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
2560
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
2561
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
2562
+ elif mineral == "Ctl":
2563
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["rho"], 3)
2564
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["K"], 3)
2565
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chrysotile["G"], 3)
2566
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["GR"], 3)
2567
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["PE"], 3)
2568
+ elif mineral == "Di":
2569
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["rho"], 3)
2570
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["K"], 3)
2571
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_diopside["G"], 3)
2572
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["GR"], 3)
2573
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["PE"], 3)
2574
+ elif mineral == "Tlc":
2575
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["rho"], 3)
2576
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["K"], 3)
2577
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_talc["G"], 3)
2578
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["GR"], 3)
2579
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["PE"], 3)
2580
+ elif mineral == "Tr":
2581
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["rho"], 3)
2582
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["K"], 3)
2583
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_tremolite["G"], 3)
2584
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["GR"], 3)
2585
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["PE"], 3)
2586
+ #
2587
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2588
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2589
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2590
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2591
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2592
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2593
+ #
2594
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2595
+ bulk_properties["rho"].append(rho_helper)
2596
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2597
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2598
+ bulk_properties["E"].append(youngsmod_helper)
2599
+ bulk_properties["nu"].append(poisson_helper)
2600
+ bulk_properties["vP"].append(vP_helper)
2601
+ bulk_properties["vS"].append(vS_helper)
2602
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2603
+ bulk_properties["GR"].append(round(gr_helper, 3))
2604
+ bulk_properties["PE"].append(round(pe_helper, 3))
2605
+ bulk_properties["phi"].append(round(phi_helper, 3))
2606
+ n += 1
2607
+ #
2608
+ results = {}
2609
+ results["rock"] = "Greenschist"
2610
+ if number > 1:
2611
+ results["mineralogy"] = amounts_mineralogy
2612
+ results["chemistry"] = amounts_chemistry
2613
+ results["phi"] = bulk_properties["phi"]
2614
+ results["fluid"] = "water"
2615
+ results["rho_s"] = bulk_properties["rho_s"]
2616
+ results["rho"] = bulk_properties["rho"]
2617
+ results["vP"] = bulk_properties["vP"]
2618
+ results["vS"] = bulk_properties["vS"]
2619
+ results["vP/vS"] = bulk_properties["vPvS"]
2620
+ results["K"] = bulk_properties["K"]
2621
+ results["G"] = bulk_properties["G"]
2622
+ results["E"] = bulk_properties["E"]
2623
+ results["nu"] = bulk_properties["nu"]
2624
+ results["GR"] = bulk_properties["GR"]
2625
+ results["PE"] = bulk_properties["PE"]
2626
+ else:
2627
+ single_amounts_mineralogy = {}
2628
+ single_amounts_chemistry = {}
2629
+ for mineral, value in amounts_mineralogy.items():
2630
+ single_amounts_mineralogy[mineral] = value[0]
2631
+ for element, value in amounts_chemistry.items():
2632
+ single_amounts_chemistry[element] = value[0]
2633
+ results["mineralogy"] = single_amounts_mineralogy
2634
+ results["chemistry"] = single_amounts_chemistry
2635
+ results["phi"] = bulk_properties["phi"][0]
2636
+ results["fluid"] = "water"
2637
+ results["rho_s"] = bulk_properties["rho_s"][0]
2638
+ results["rho"] = bulk_properties["rho"][0]
2639
+ results["vP"] = bulk_properties["vP"][0]
2640
+ results["vS"] = bulk_properties["vS"][0]
2641
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2642
+ results["K"] = bulk_properties["K"][0]
2643
+ results["G"] = bulk_properties["G"][0]
2644
+ results["E"] = bulk_properties["E"][0]
2645
+ results["nu"] = bulk_properties["nu"][0]
2646
+ results["GR"] = bulk_properties["GR"][0]
2647
+ results["PE"] = bulk_properties["PE"][0]
2648
+ #
2649
+ return results
2650
+ #
2651
+ def create_greenschist_pelitic(self, number, porosity=None):
2652
+ #
2653
+ data_quartz = Oxides(impurity="pure", data_type=True).create_quartz() # fixed
2654
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar() # variable
2655
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase() # variable
2656
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite() # variable
2657
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite() # variable
2658
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet() # variable
2659
+ data_pyrophyllite = Phyllosilicates(impurity="pure", data_type=True).create_pyrophyllite() # fixed
2660
+ #
2661
+ assemblage = [data_quartz, data_alkalifeldspar, data_plagioclase, data_chlorite, data_muscovite,
2662
+ data_garnet_al, data_pyrophyllite]
2663
+ #
2664
+ amounts_mineralogy = {}
2665
+ amounts_chemistry = {}
2666
+ bulk_properties = {}
2667
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
2668
+ for property in properties:
2669
+ bulk_properties[property] = []
2670
+ mineral_list = []
2671
+ elements = []
2672
+ for mineral in assemblage:
2673
+ amounts_mineralogy[mineral["mineral"]] = []
2674
+ mineral_list.append(mineral["mineral"])
2675
+ elements_mineral = list(mineral["chemistry"].keys())
2676
+ for element in elements_mineral:
2677
+ if element not in elements:
2678
+ elements.append(element)
2679
+ amounts_chemistry[element] = []
2680
+ mineral_list.sort()
2681
+ elements.sort()
2682
+ #
2683
+ n = 0
2684
+ amounts_helper = []
2685
+ while n < number:
2686
+ w_total = 0
2687
+ n_minerals = 0
2688
+ for mineral in mineral_list:
2689
+ if mineral == "Qz": # Qz (0.25, 0.7), Kfs (0.05, 0.15), Pl (0.05, 0.15), Chl (0.15, 0.3), Ms (0, 0.1), Grt (0, 0.05), Prl (0, 0.05)
2690
+ if n_minerals < len(mineral_list)-1:
2691
+ value = round(1-w_total, 4)
2692
+ else:
2693
+ value = round(1-w_total, 4)
2694
+ if value >= 0.0 and 0.25 <= value <= 0.70:
2695
+ amounts_helper.append(value)
2696
+ w_total += value
2697
+ n_minerals += 1
2698
+ elif mineral == "Kfs":
2699
+ if n_minerals < len(mineral_list)-1:
2700
+ value = round(rd.uniform(0.05, 0.15), 4)
2701
+ else:
2702
+ value = round(1-w_total, 4)
2703
+ if value >= 0.0 and 0.05 <= value <= 0.15:
2704
+ amounts_helper.append(value)
2705
+ w_total += value
2706
+ n_minerals += 1
2707
+ elif mineral == "Pl":
2708
+ if n_minerals < len(mineral_list)-1:
2709
+ value = round(rd.uniform(0.05, 0.15), 4)
2710
+ else:
2711
+ value = round(1-w_total, 4)
2712
+ if value >= 0.0 and 0.05 <= value <= 0.15:
2713
+ amounts_helper.append(value)
2714
+ w_total += value
2715
+ n_minerals += 1
2716
+ elif mineral == "Chl":
2717
+ if n_minerals < len(mineral_list)-1:
2718
+ value = round(rd.uniform(0.15, 0.30), 4)
2719
+ else:
2720
+ value = round(1-w_total, 4)
2721
+ if value >= 0.0 and 0.15 <= value <= 0.30:
2722
+ amounts_helper.append(value)
2723
+ w_total += value
2724
+ n_minerals += 1
2725
+ elif mineral == "Ms":
2726
+ if n_minerals < len(mineral_list)-1:
2727
+ value = round(rd.uniform(0.0, 0.10), 4)
2728
+ else:
2729
+ value = round(1-w_total, 4)
2730
+ if value >= 0.0 and 0.0 <= value <= 0.10:
2731
+ amounts_helper.append(value)
2732
+ w_total += value
2733
+ n_minerals += 1
2734
+ elif mineral == "Grt":
2735
+ if n_minerals < len(mineral_list)-1:
2736
+ value = round(rd.uniform(0.0, 0.05), 4)
2737
+ else:
2738
+ value = round(1-w_total, 4)
2739
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2740
+ amounts_helper.append(value)
2741
+ w_total += value
2742
+ n_minerals += 1
2743
+ elif mineral == "Prl":
2744
+ if n_minerals < len(mineral_list)-1:
2745
+ value = round(rd.uniform(0.0, 0.05), 4)
2746
+ else:
2747
+ value = round(1-w_total, 4)
2748
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2749
+ amounts_helper.append(value)
2750
+ w_total += value
2751
+ n_minerals += 1
2752
+ #
2753
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
2754
+ for index, mineral in enumerate(mineral_list):
2755
+ amounts_mineralogy[mineral].append(amounts_helper[index])
2756
+ n += 1
2757
+ amounts_helper.clear()
2758
+ else:
2759
+ n += 0
2760
+ amounts_helper.clear()
2761
+ #
2762
+ n = 0
2763
+ amounts_helper = {}
2764
+ while n < number:
2765
+ w_total = 0
2766
+ n_elements = 0
2767
+ rho_s_helper = 0
2768
+ bulkmod_helper = 0
2769
+ shearmod_helper = 0
2770
+ gr_helper = 0
2771
+ pe_helper = 0
2772
+ if porosity == None:
2773
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
2774
+ else:
2775
+ phi_helper = porosity
2776
+ #
2777
+ x_kfs = rd.uniform(0.9, 1.0)
2778
+ x_pl = rd.uniform(0.9, 1.0)
2779
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar(x_value=x_kfs)
2780
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(x_value=x_pl)
2781
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2782
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
2783
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
2784
+ #
2785
+ for element in elements:
2786
+ amounts_helper[element] = 0
2787
+ if element in data_quartz["chemistry"]:
2788
+ if n_elements < len(elements)-1:
2789
+ value = round(amounts_mineralogy["Qz"][n]*data_quartz["chemistry"][element], 4)
2790
+ else:
2791
+ value = round(1-w_total, 4)
2792
+ amounts_helper[element] += value
2793
+ w_total += value
2794
+ if element in data_alkalifeldspar["chemistry"]:
2795
+ if n_elements < len(elements)-1:
2796
+ value = round(amounts_mineralogy["Kfs"][n]*data_alkalifeldspar["chemistry"][element], 4)
2797
+ else:
2798
+ value = round(1-w_total, 4)
2799
+ amounts_helper[element] += value
2800
+ w_total += value
2801
+ if element in data_plagioclase["chemistry"]:
2802
+ if n_elements < len(elements)-1:
2803
+ value = round(amounts_mineralogy["Pl"][n]*data_plagioclase["chemistry"][element], 4)
2804
+ else:
2805
+ value = round(1-w_total, 4)
2806
+ amounts_helper[element] += value
2807
+ w_total += value
2808
+ if element in data_chlorite["chemistry"]:
2809
+ if n_elements < len(elements)-1:
2810
+ value = round(amounts_mineralogy["Chl"][n]*data_chlorite["chemistry"][element], 4)
2811
+ else:
2812
+ value = round(1-w_total, 4)
2813
+ amounts_helper[element] += value
2814
+ w_total += value
2815
+ if element in data_muscovite["chemistry"]:
2816
+ if n_elements < len(elements)-1:
2817
+ value = round(amounts_mineralogy["Ms"][n]*data_muscovite["chemistry"][element], 4)
2818
+ else:
2819
+ value = round(1-w_total, 4)
2820
+ amounts_helper[element] += value
2821
+ w_total += value
2822
+ if element in data_garnet_al["chemistry"]:
2823
+ if n_elements < len(elements)-1:
2824
+ value = round(amounts_mineralogy["Grt"][n]*data_garnet_al["chemistry"][element], 4)
2825
+ else:
2826
+ value = round(1-w_total, 4)
2827
+ amounts_helper[element] += value
2828
+ w_total += value
2829
+ if element in data_pyrophyllite["chemistry"]:
2830
+ if n_elements < len(elements)-1:
2831
+ value = round(amounts_mineralogy["Prl"][n]*data_pyrophyllite["chemistry"][element], 4)
2832
+ else:
2833
+ value = round(1-w_total, 4)
2834
+ amounts_helper[element] += value
2835
+ w_total += value
2836
+ #
2837
+ n_elements += 1
2838
+ if sum(amounts_helper.values()) == 1.0:
2839
+ for key, value in amounts_helper.items():
2840
+ amounts_chemistry[key].append(round(value, 4))
2841
+ for mineral in mineral_list:
2842
+ if mineral == "Qz":
2843
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_quartz["rho"], 3)
2844
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_quartz["K"], 3)
2845
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_quartz["G"], 3)
2846
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_quartz["GR"], 3)
2847
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_quartz["PE"], 3)
2848
+ elif mineral == "Kfs":
2849
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["rho"], 3)
2850
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["K"], 3)
2851
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_alkalifeldspar["G"], 3)
2852
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["GR"], 3)
2853
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["PE"], 3)
2854
+ elif mineral == "Pl":
2855
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["rho"], 3)
2856
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["K"], 3)
2857
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_plagioclase["G"], 3)
2858
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["GR"], 3)
2859
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["PE"], 3)
2860
+ elif mineral == "Chl":
2861
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["rho"], 3)
2862
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["K"], 3)
2863
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_chlorite["G"], 3)
2864
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["GR"], 3)
2865
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["PE"], 3)
2866
+ elif mineral == "Ms":
2867
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["rho"], 3)
2868
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["K"], 3)
2869
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_muscovite["G"], 3)
2870
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["GR"], 3)
2871
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["PE"], 3)
2872
+ elif mineral == "Grt":
2873
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["rho"], 3)
2874
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["K"], 3)
2875
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_garnet_al["G"], 3)
2876
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["GR"], 3)
2877
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["PE"], 3)
2878
+ elif mineral == "Prl":
2879
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["rho"], 3)
2880
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["K"], 3)
2881
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_pyrophyllite["G"], 3)
2882
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["GR"], 3)
2883
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["PE"], 3)
2884
+ #
2885
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2886
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2887
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2888
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2889
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2890
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2891
+ #
2892
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2893
+ bulk_properties["rho"].append(rho_helper)
2894
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2895
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2896
+ bulk_properties["E"].append(youngsmod_helper)
2897
+ bulk_properties["nu"].append(poisson_helper)
2898
+ bulk_properties["vP"].append(vP_helper)
2899
+ bulk_properties["vS"].append(vS_helper)
2900
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2901
+ bulk_properties["GR"].append(round(gr_helper, 3))
2902
+ bulk_properties["PE"].append(round(pe_helper, 3))
2903
+ bulk_properties["phi"].append(round(phi_helper, 3))
2904
+ n += 1
2905
+ #
2906
+ results = {}
2907
+ results["rock"] = "Greenschist"
2908
+ if number > 1:
2909
+ results["mineralogy"] = amounts_mineralogy
2910
+ results["chemistry"] = amounts_chemistry
2911
+ results["phi"] = bulk_properties["phi"]
2912
+ results["fluid"] = "water"
2913
+ results["rho_s"] = bulk_properties["rho_s"]
2914
+ results["rho"] = bulk_properties["rho"]
2915
+ results["vP"] = bulk_properties["vP"]
2916
+ results["vS"] = bulk_properties["vS"]
2917
+ results["vP/vS"] = bulk_properties["vPvS"]
2918
+ results["K"] = bulk_properties["K"]
2919
+ results["G"] = bulk_properties["G"]
2920
+ results["E"] = bulk_properties["E"]
2921
+ results["nu"] = bulk_properties["nu"]
2922
+ results["GR"] = bulk_properties["GR"]
2923
+ results["PE"] = bulk_properties["PE"]
2924
+ else:
2925
+ single_amounts_mineralogy = {}
2926
+ single_amounts_chemistry = {}
2927
+ for mineral, value in amounts_mineralogy.items():
2928
+ single_amounts_mineralogy[mineral] = value[0]
2929
+ for element, value in amounts_chemistry.items():
2930
+ single_amounts_chemistry[element] = value[0]
2931
+ results["mineralogy"] = single_amounts_mineralogy
2932
+ results["chemistry"] = single_amounts_chemistry
2933
+ results["phi"] = bulk_properties["phi"][0]
2934
+ results["fluid"] = "water"
2935
+ results["rho_s"] = bulk_properties["rho_s"][0]
2936
+ results["rho"] = bulk_properties["rho"][0]
2937
+ results["vP"] = bulk_properties["vP"][0]
2938
+ results["vS"] = bulk_properties["vS"][0]
2939
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2940
+ results["K"] = bulk_properties["K"][0]
2941
+ results["G"] = bulk_properties["G"][0]
2942
+ results["E"] = bulk_properties["E"][0]
2943
+ results["nu"] = bulk_properties["nu"][0]
2944
+ results["GR"] = bulk_properties["GR"][0]
2945
+ results["PE"] = bulk_properties["PE"][0]
2946
+ #
2947
+ return results
2948
+
2949
+ class AmphiboliteFacies:
2950
+
2951
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
2952
+ self.fluid = fluid
2953
+ self.actualThickness = actual_thickness
2954
+ self.porosity = porosity
2955
+
2956
+ ## Minerals
2957
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
2958
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
2959
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
2960
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
2961
+
2962
+ ## Fluids
2963
+ self.data_water = Water.water("")
2964
+
2965
+ def create_amphibolite_ortho(self, number=1, composition=None):
2966
+ results_container = {}
2967
+ results_container["rock"] = "Ortho-Amphibolite"
2968
+ results_container["mineralogy"] = {}
2969
+ results_container["chemistry"] = {}
2970
+ results_container["compounds"] = {}
2971
+ results_container["phi"] = []
2972
+ results_container["fluid"] = self.fluid
2973
+ results_container["rho_s"] = []
2974
+ results_container["rho"] = []
2975
+ results_container["vP"] = []
2976
+ results_container["vS"] = []
2977
+ results_container["vP/vS"] = []
2978
+ results_container["K"] = []
2979
+ results_container["G"] = []
2980
+ results_container["E"] = []
2981
+ results_container["nu"] = []
2982
+ results_container["GR"] = []
2983
+ results_container["PE"] = []
2984
+
2985
+ n = 0
2986
+ while n < number:
2987
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
2988
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
2989
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
2990
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2991
+ data_apatite = Phosphates(data_type=True).create_aptite()
2992
+
2993
+ mineralogy = {"Tr": self.data_tremolite, "Act": data_actinolite, "Pl": data_plagioclase, "Bt": data_biotite,
2994
+ "Qz": self.data_quartz, "Chl": data_chlorite, "Ap": data_apatite}
2995
+
2996
+ minerals_list = list(mineralogy.keys())
2997
+
2998
+ if minerals_list[0] not in results_container["mineralogy"]:
2999
+ for mineral in minerals_list:
3000
+ results_container["mineralogy"][mineral] = []
3001
+
3002
+ if self.porosity == None:
3003
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
3004
+ else:
3005
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
3006
+
3007
+ condition = False
3008
+
3009
+ while condition == False:
3010
+ elements_list = []
3011
+ phi_minerals = {}
3012
+ w_minerals = {}
3013
+ w_elements = {}
3014
+
3015
+ if composition != None:
3016
+ phi_tr = composition["Tr"]
3017
+ phi_act = composition["Act"]
3018
+ phi_pl = composition["Pl"]
3019
+ phi_bt = composition["Bt"]
3020
+ phi_qz = composition["Qz"]
3021
+ phi_chl = composition["Chl"]
3022
+ phi_ap = composition["Ap"]
3023
+
3024
+ phi_minerals["Tr"] = phi_tr
3025
+ phi_minerals["Act"] = phi_act
3026
+ phi_minerals["Pl"] = phi_pl
3027
+ phi_minerals["Bt"] = phi_bt
3028
+ phi_minerals["Qz"] = phi_qz
3029
+ phi_minerals["Chl"] = phi_chl
3030
+ phi_minerals["Ap"] = phi_ap
3031
+ else:
3032
+ condition_2 = False
3033
+
3034
+ while condition_2 == False:
3035
+ phi_tr = round(rd.uniform(0.0, 0.5), 4)
3036
+ phi_act = round(rd.uniform(0.0, (1.0 - phi_tr)), 4)
3037
+ phi_pl = round(rd.uniform(0.15, (1.0 - phi_tr - phi_act)), 4)
3038
+ phi_bt = round(rd.uniform(0.0, (1.0 - phi_tr - phi_act - phi_pl)), 4)
3039
+ phi_qz = round(rd.uniform(0.0, (1.0 - phi_tr - phi_act - phi_pl - phi_bt)), 4)
3040
+ phi_chl = round(rd.uniform(0.0, (1.0 - phi_tr - phi_act - phi_pl - phi_bt - phi_qz)), 4)
3041
+ phi_ap = round(1 - phi_tr - phi_act - phi_pl - phi_bt - phi_qz - phi_chl, 4)
3042
+ phi_total = phi_tr + phi_act + phi_pl + phi_bt + phi_qz + phi_chl + phi_ap
3043
+
3044
+ if np.isclose(phi_total, 1.0000) == True:
3045
+ if (0.0 <= phi_tr <= 0.5 and 0.0 <= phi_act <= 0.5 and 0.15 <= phi_pl <= 0.4
3046
+ and 0.0 <= phi_bt <= 0.2 and 0.0 <= phi_qz <= 0.2 and 0.0 <= phi_chl <= 0.1
3047
+ and 0.0 <= phi_ap <= 0.1):
3048
+ condition_2 = True
3049
+
3050
+ phi_minerals["Tr"] = phi_tr
3051
+ phi_minerals["Act"] = phi_act
3052
+ phi_minerals["Pl"] = phi_pl
3053
+ phi_minerals["Bt"] = phi_bt
3054
+ phi_minerals["Qz"] = phi_qz
3055
+ phi_minerals["Chl"] = phi_chl
3056
+ phi_minerals["Ap"] = phi_ap
3057
+
3058
+ rho_s = 0
3059
+ velocities_minerals = {}
3060
+ for key, value in phi_minerals.items():
3061
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
3062
+
3063
+ velocities_minerals[key] = {}
3064
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
3065
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
3066
+
3067
+ for element, value in mineralogy[key]["chemistry"].items():
3068
+ if element not in elements_list:
3069
+ elements_list.append(element)
3070
+ w_elements[element] = 0.0
3071
+
3072
+ if elements_list[0] not in results_container["chemistry"]:
3073
+ for element in elements_list:
3074
+ results_container["chemistry"][element] = []
3075
+
3076
+ rho_s = round(rho_s, 3)
3077
+
3078
+ n_minerals = len(minerals_list)
3079
+ w_minerals_total = 0
3080
+ for index, (key, value) in enumerate(phi_minerals.items()):
3081
+ if key == "Urn":
3082
+ n_digits = 4
3083
+ else:
3084
+ n_digits = 4
3085
+
3086
+ if index < n_minerals - 1:
3087
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
3088
+ w_minerals[key] = result
3089
+ w_minerals_total += result
3090
+ else:
3091
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
3092
+
3093
+ total_w_minerals = round(sum(w_minerals.values()), 4)
3094
+
3095
+ if self.fluid == "water":
3096
+ data_fluid = self.data_water
3097
+
3098
+ old_index = elements_list.index("O")
3099
+ elements_list += [elements_list.pop(old_index)]
3100
+
3101
+ w_elements_total = 0.0
3102
+ for element in elements_list:
3103
+ if element != "O":
3104
+ for mineral, w_mineral in w_minerals.items():
3105
+ if element in mineralogy[mineral]["chemistry"]:
3106
+ if element == "U":
3107
+ n_digits = 4
3108
+ else:
3109
+ n_digits = 4
3110
+
3111
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
3112
+ w_elements[element] += value
3113
+ w_elements_total += value
3114
+
3115
+ w_elements[element] = round(w_elements[element], n_digits)
3116
+
3117
+ elif element == "O":
3118
+ w_elements[element] += round(1 - w_elements_total, 4)
3119
+ w_elements[element] = round(w_elements[element], 4)
3120
+
3121
+ total_w_elements = round(sum(w_elements.values()), 4)
3122
+
3123
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
3124
+ for key, value in w_minerals.items():
3125
+ w_minerals[key] = abs(value)
3126
+
3127
+ for key, value in w_elements.items():
3128
+ w_elements[key] = abs(value)
3129
+
3130
+ condition = True
3131
+
3132
+ gamma_ray = 0.0
3133
+ photoelectricity = 0.0
3134
+
3135
+ K_list = []
3136
+ G_list = []
3137
+ bulk_mod = 0
3138
+ shear_mod = 0
3139
+ phi_list = []
3140
+ for key, value in phi_minerals.items():
3141
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
3142
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
3143
+
3144
+ gamma_ray = round(gamma_ray, 3)
3145
+ photoelectricity = round(photoelectricity, 3)
3146
+
3147
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
3148
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
3149
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
3150
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
3151
+ phi_list.append(phi_minerals[key])
3152
+
3153
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
3154
+ bulk_mod = round(bulk_mod, 3)
3155
+ shear_mod = round(shear_mod, 3)
3156
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
3157
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
3158
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
3159
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
3160
+ vPvS = round(vP/vS, 3)
3161
+
3162
+ ## RESULTS
3163
+ for key, value in w_minerals.items():
3164
+ results_container["mineralogy"][key].append(value)
3165
+
3166
+ for key, value in w_elements.items():
3167
+ results_container["chemistry"][key].append(value)
3168
+
3169
+ amounts = []
3170
+ for key, value in w_elements.items():
3171
+ results_container["chemistry"][key].append(value)
3172
+ chem_data = PeriodicSystem(name=key).get_data()
3173
+ amounts.append([key, chem_data[1], value])
3174
+
3175
+ list_elements = list(w_elements.keys())
3176
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
3177
+ composition_oxides = {}
3178
+
3179
+ for var_oxide in list_oxides:
3180
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
3181
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
3182
+
3183
+ if list_oxides[0] not in results_container["compounds"]:
3184
+ for oxide in list_oxides:
3185
+ results_container["compounds"][oxide] = []
3186
+
3187
+ for key, value in composition_oxides.items():
3188
+ results_container["compounds"][key].append(value)
3189
+
3190
+ results_container["mineralogy"] = dict(sorted(
3191
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
3192
+ results_container["chemistry"] = dict(sorted(
3193
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
3194
+ results_container["compounds"] = dict(sorted(
3195
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
3196
+
3197
+ results_container["phi"].append(phi_helper)
3198
+ results_container["rho_s"].append(rho_s)
3199
+ results_container["rho"].append(rho)
3200
+ results_container["vP"].append(vP)
3201
+ results_container["vS"].append(vS)
3202
+ results_container["vP/vS"].append(vPvS)
3203
+ results_container["K"].append(bulk_mod)
3204
+ results_container["G"].append(shear_mod)
3205
+ results_container["E"].append(youngs_mod)
3206
+ results_container["nu"].append(poisson_rat)
3207
+ results_container["GR"].append(gamma_ray)
3208
+ results_container["PE"].append(photoelectricity)
3209
+
3210
+ n += 1
3211
+
3212
+ return results_container
3213
+
3214
+ ## TEST
3215
+ # print("Test: Granulite")
3216
+ # print(MetamorphicRocks().create_granulite(number=1))
3217
+ # print(MetamorphicRocks().create_granulite(number=10)
3218
+ # print("Test: Greenschist")
3219
+ # print(MetamorphicRocks().create_greenschist(number=1))
3220
+ # print(MetamorphicRocks().create_greenschist(number=10))
3221
+ # print("Test: Amphibolite")
3222
+ # print(MetamorphicRocks().create_amphibolite_ortho(number=1))