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,2658 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ #-----------------------------------------------
5
+
6
+ # Name: carbonates.py
7
+ # Author: Maximilian A. Beeskow
8
+ # Version: 1.0
9
+ # Date: 10.12.2024
10
+
11
+ #-----------------------------------------------
12
+
13
+ ## MODULES
14
+ import numpy as np
15
+ from numpy import round
16
+ from random import *
17
+ import random as rd
18
+ from modules import minerals
19
+ from modules import fluids
20
+ from modules.geophysics import Elasticity as elast
21
+ from modules.chemistry import PeriodicSystem, OxideCompounds
22
+ from modules.minerals import CrystalPhysics
23
+ from modules.geophysics import WellLog as wg
24
+ from modules.geochemistry import MineralChemistry
25
+ from modules.minerals import Organics
26
+ from modules.oxides import Oxides
27
+ from modules.silicates import Tectosilicates, Phyllosilicates
28
+ from modules.sulfides import Sulfides
29
+ from modules.pyllosilicates import Pyllosilicates
30
+ from modules.sulfates import Sulfates
31
+ from modules.fluids import Water
32
+ from modules.petrophysics import SeismicVelocities
33
+
34
+ ## CLASSES
35
+ class CarbonateRocks:
36
+ #
37
+ def __init__(self, fluid="water", actualThickness=100):
38
+ self.fluid = fluid
39
+ self.actualThickness = actualThickness
40
+ #
41
+ self.data_calcite = Carbonates(impurity="pure", data_type=True).create_calcite()
42
+ self.data_aragonite = Carbonates(impurity="pure", data_type=True).create_aragonite()
43
+ self.data_dolomite = Carbonates(impurity="pure", data_type=True).create_dolomite()
44
+ self.data_siderite = Carbonates(impurity="pure", data_type=True).create_siderite()
45
+ self.data_magnesite = Carbonates(impurity="pure", data_type=True).create_magnesite()
46
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
47
+ self.data_hematite = Oxides(impurity="pure", data_type=True).create_hematite()
48
+ self.data_kaolinite = Phyllosilicates(impurity="pure", data_type=True).create_kaolinite()
49
+ self.data_pyrite = Sulfides(impurity="pure", data_type=True).create_pyrite()
50
+ #
51
+ self.data_water = Water.water("")
52
+
53
+ def create_limestone(self, number=1, composition=None, porosity=None):
54
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
55
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
56
+ data_illite = Phyllosilicates(impurity="pure", data_type=True).create_illite()
57
+ #
58
+ mineralogy = {"Cal": self.data_calcite, "Dol": self.data_dolomite, "Qz": self.data_quartz,
59
+ "Kfs": data_alkalifeldspar, "Pl": data_plagioclase, "Kln": self.data_kaolinite,
60
+ "Ilt": data_illite, "Py": self.data_pyrite}
61
+ #
62
+ amounts_mineralogy = {}
63
+ amounts_chemistry = {}
64
+ amounts_compounds = {}
65
+ bulk_properties = {}
66
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
67
+ for property in properties:
68
+ bulk_properties[property] = []
69
+ mineral_list = []
70
+ elements = []
71
+ for mineral, dataset in mineralogy.items():
72
+ amounts_mineralogy[dataset["mineral"]] = []
73
+ mineral_list.append(dataset["mineral"])
74
+ elements_mineral = list(dataset["chemistry"].keys())
75
+ for element in elements_mineral:
76
+ if element not in elements:
77
+ elements.append(element)
78
+ amounts_chemistry[element] = []
79
+ mineral_list.sort()
80
+ elements.sort()
81
+ #
82
+ n = 0
83
+ while n < number:
84
+ condition = False
85
+ while condition == False:
86
+ elements_list = []
87
+ phi_minerals = {}
88
+ w_minerals = {}
89
+ w_elements = {}
90
+ #
91
+ if composition != None:
92
+ phi_cal = composition["Cal"]
93
+ phi_dol = composition["Dol"]
94
+ phi_qz = composition["Qz"]
95
+ phi_kfs = composition["Kfs"]
96
+ phi_pl = composition["Pl"]
97
+ phi_kln = composition["Kln"]
98
+ phi_ilt = composition["Ilt"]
99
+ phi_py = composition["Py"]
100
+ #
101
+ phi_minerals["Cal"] = phi_cal
102
+ phi_minerals["Dol"] = phi_dol
103
+ phi_minerals["Qz"] = phi_qz
104
+ phi_minerals["Kfs"] = phi_kfs
105
+ phi_minerals["Pl"] = phi_pl
106
+ phi_minerals["Kln"] = phi_kln
107
+ phi_minerals["Ilt"] = phi_ilt
108
+ phi_minerals["Py"] = phi_py
109
+ #
110
+ else:
111
+ condition_2 = False
112
+ while condition_2 == False:
113
+ magicnumber = rd.randint(0, 12)
114
+ if 0 <= magicnumber <= 8: # Carbonate-dominated
115
+ w_carb = round(rd.uniform(0.95, 1.0), 4)
116
+ w_clast = round(rd.uniform(0.0, (1.0 - w_carb)), 4)
117
+ w_clay = round(rd.uniform(0.0, (1.0 - w_carb - w_clast)), 4)
118
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
119
+ #
120
+ phi_cal = round(w_carb*rd.uniform(0.975, 1.0), 4)
121
+ phi_dol = round(w_carb - phi_cal, 4)
122
+ #
123
+ phi_qz = round(w_clast*rd.uniform(0.0, 1.0), 4)
124
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
125
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
126
+ #
127
+ magicnumber_2 = rd.randint(0, 1)
128
+ if magicnumber_2 == 0:
129
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
130
+ phi_ilt = round(w_clay - phi_kln, 4)
131
+ else:
132
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
133
+ phi_kln = round(w_clay - phi_ilt, 4)
134
+ #
135
+ phi_py = round(w_sulf, 4)
136
+ #
137
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
138
+ #
139
+ elif magicnumber in [9, 10]: # Clastic-dominated
140
+ w_clast = round(rd.uniform(0.05, 0.10), 4)
141
+ w_carb = round(rd.uniform(0.90, (1.0 - w_clast)), 4)
142
+ w_clay = round(rd.uniform(0.0, (1.0 - w_carb - w_clast)), 4)
143
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
144
+ #
145
+ phi_qz = round(w_clast*rd.uniform(0.0, 1.0), 4)
146
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
147
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
148
+ #
149
+ phi_cal = round(w_carb*rd.uniform(0.975, 1.0), 4)
150
+ phi_dol = round(w_carb - phi_cal, 4)
151
+ #
152
+ magicnumber_2 = rd.randint(0, 1)
153
+ if magicnumber_2 == 0:
154
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
155
+ phi_ilt = round(w_clay - phi_kln, 4)
156
+ else:
157
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
158
+ phi_kln = round(w_clay - phi_ilt, 4)
159
+ #
160
+ phi_py = round(w_sulf, 4)
161
+ #
162
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
163
+ #
164
+ elif magicnumber in [11, 12]: # Clay-dominated
165
+ w_clay = round(rd.uniform(0.05, 0.10), 4)
166
+ w_carb = round(rd.uniform(0.90, (1.0 - w_clay)), 4)
167
+ w_clast = round(rd.uniform(0.0, (1.0 - w_carb - w_clay)), 4)
168
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
169
+ #
170
+ phi_cal = round(w_carb*rd.uniform(0.975, 1.0), 4)
171
+ phi_dol = round(w_carb - phi_cal, 4)
172
+ #
173
+ phi_qz = round(w_clast*rd.uniform(0.0, 1.0), 4)
174
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
175
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
176
+ #
177
+ magicnumber_2 = rd.randint(0, 1)
178
+ if magicnumber_2 == 0:
179
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
180
+ phi_ilt = round(w_clay - phi_kln, 4)
181
+ else:
182
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
183
+ phi_kln = round(w_clay - phi_ilt, 4)
184
+ #
185
+ phi_py = round(w_sulf, 4)
186
+ #
187
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
188
+ #
189
+ if np.isclose(phi_total, 1.0000) == True:
190
+ if 0.9 <= phi_cal <= 1.0 and 0.0 <= phi_dol <= 0.2 and 0.0 <= phi_qz <= 0.3 \
191
+ and 0.0 <= phi_kfs <= 0.2 and 0.0 <= phi_pl <= 0.2 \
192
+ and 0.0 <= phi_kln <= 0.3 and 0.0 <= phi_ilt <= 0.3 and 0.0 <= phi_py <= 0.05:
193
+ condition_2 = True
194
+ #
195
+ phi_minerals["Cal"] = abs(phi_cal)
196
+ phi_minerals["Dol"] = abs(phi_dol)
197
+ phi_minerals["Qz"] = abs(phi_qz)
198
+ phi_minerals["Kfs"] = abs(phi_kfs)
199
+ phi_minerals["Pl"] = abs(phi_pl)
200
+ phi_minerals["Kln"] = abs(phi_kln)
201
+ phi_minerals["Ilt"] = abs(phi_ilt)
202
+ phi_minerals["Py"] = abs(phi_py)
203
+ #
204
+ rho_s = 0
205
+ velocity_solid = {"vP": 0, "vS": 0}
206
+ gamma_ray = 0.0
207
+ photoelectricity = 0.0
208
+ for key, value in phi_minerals.items():
209
+ rho_s += value*mineralogy[key]["rho"]
210
+ velocity_solid["vP"] += value*mineralogy[key]["vP"]
211
+ velocity_solid["vS"] += value*mineralogy[key]["vS"]
212
+ gamma_ray += value*mineralogy[key]["GR"]
213
+ photoelectricity += value*mineralogy[key]["PE"]
214
+ #
215
+ for element, value in mineralogy[key]["chemistry"].items():
216
+ if element not in elements_list:
217
+ elements_list.append(element)
218
+ w_elements[element] = 0.0
219
+ #
220
+ rho_s = round(rho_s, 3)
221
+ #
222
+ for key, value in phi_minerals.items():
223
+ w_result = round((phi_minerals[key] * mineralogy[key]["rho"]) / rho_s, 4)
224
+ w_minerals[key] = w_result
225
+ #
226
+ old_index = elements_list.index("O")
227
+ elements_list += [elements_list.pop(old_index)]
228
+ #
229
+ w_elements_total = 0.0
230
+ for element in elements_list:
231
+ if element != "O":
232
+ for mineral, w_mineral in w_minerals.items():
233
+ if element in mineralogy[mineral]["chemistry"]:
234
+ value = round(w_mineral * mineralogy[mineral]["chemistry"][element], 4)
235
+ w_elements[element] += value
236
+ w_elements_total += value
237
+ #
238
+ w_elements[element] = round(w_elements[element], 4)
239
+ elif element == "O":
240
+ w_elements[element] += round(1 - w_elements_total, 4)
241
+ #
242
+ w_elements[element] = round(w_elements[element], 4)
243
+ #
244
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
245
+ #
246
+ condition = True
247
+ #
248
+ ## Bulk Density, Porosity, Seismic Velocities
249
+ rho_solid = round(rho_s, 3)
250
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
251
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
252
+ rho_limits=[1800, 2800], vP_limits=[3500, 6500], vS_limits=[2000, 3500], delta=0.05,
253
+ porosity=porosity)
254
+ ## Elastic Parameters
255
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
256
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
257
+ rho=rho, vP=vP, vS=vS)
258
+ ## Gamma Ray
259
+ gamma_ray = round(gamma_ray, 3)
260
+ ## Photoelectricity
261
+ photoelectricity = round(photoelectricity, 3)
262
+
263
+ for mineral, value in w_minerals.items():
264
+ amounts_mineralogy[mineral].append(float(value))
265
+ for element, value in w_elements.items():
266
+ amounts_chemistry[element].append(float(value))
267
+
268
+ bulk_properties["rho_s"].append(float(rho_solid))
269
+ bulk_properties["rho"].append(float(rho))
270
+ bulk_properties["phi"].append(float(var_porosity))
271
+ bulk_properties["K"].append(float(bulk_modulus))
272
+ bulk_properties["G"].append(float(shear_modulus))
273
+ bulk_properties["E"].append(float(youngs_modulus))
274
+ bulk_properties["nu"].append(float(poisson_ratio))
275
+ bulk_properties["vP"].append(float(vP))
276
+ bulk_properties["vS"].append(float(vS))
277
+ bulk_properties["vPvS"].append(float(vPvS))
278
+ bulk_properties["GR"].append(float(gamma_ray))
279
+ bulk_properties["PE"].append(float(photoelectricity))
280
+
281
+ amounts = []
282
+ for key, value in w_elements.items():
283
+ amounts_chemistry[key].append(value)
284
+ chem_data = PeriodicSystem(name=key).get_data()
285
+ amounts.append([key, chem_data[1], value])
286
+
287
+ list_oxides = ["H2O", "CO2", "Na2O", "MgO", "Al2O3", "SiO2", "SO3", "K2O", "CaO", "Fe2O3"]
288
+ composition_oxides = {}
289
+ for var_oxide in list_oxides:
290
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
291
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
292
+
293
+ if list_oxides[0] not in amounts_compounds:
294
+ for oxide in list_oxides:
295
+ amounts_compounds[oxide] = []
296
+
297
+ for key, value in composition_oxides.items():
298
+ amounts_compounds[key].append(value)
299
+
300
+ n += 1
301
+ amounts_mineralogy = dict(sorted(
302
+ amounts_mineralogy.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
303
+ amounts_chemistry = dict(sorted(
304
+ amounts_chemistry.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
305
+ amounts_compounds = dict(sorted(
306
+ amounts_compounds.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
307
+
308
+ ## EXPORT DATA
309
+ #
310
+ results = {}
311
+ results["rock"] = "Limestone"
312
+ if number > 1:
313
+ results["mineralogy"] = amounts_mineralogy
314
+ results["chemistry"] = amounts_chemistry
315
+ results["compounds"] = amounts_compounds
316
+ results["phi"] = bulk_properties["phi"]
317
+ results["fluid"] = "water"
318
+ results["rho_s"] = bulk_properties["rho_s"]
319
+ results["rho"] = bulk_properties["rho"]
320
+ results["vP"] = bulk_properties["vP"]
321
+ results["vS"] = bulk_properties["vS"]
322
+ results["vP/vS"] = bulk_properties["vPvS"]
323
+ results["K"] = bulk_properties["K"]
324
+ results["G"] = bulk_properties["G"]
325
+ results["E"] = bulk_properties["E"]
326
+ results["nu"] = bulk_properties["nu"]
327
+ results["GR"] = bulk_properties["GR"]
328
+ results["PE"] = bulk_properties["PE"]
329
+ else:
330
+ single_amounts_mineralogy = {}
331
+ single_amounts_chemistry = {}
332
+ single_amounts_compounds = {}
333
+ for mineral, value in w_minerals.items():
334
+ single_amounts_mineralogy[mineral] = float(value)
335
+ for element, value in w_elements.items():
336
+ single_amounts_chemistry[element] = float(value)
337
+ for compound, value in amounts_compounds.items():
338
+ single_amounts_compounds[compound] = value[0]
339
+ results["mineralogy"] = single_amounts_mineralogy
340
+ results["chemistry"] = single_amounts_chemistry
341
+ results["compounds"] = single_amounts_compounds
342
+ results["phi"] = float(var_porosity)
343
+ results["fluid"] = "water"
344
+ results["rho_s"] = float(rho_solid)
345
+ results["rho"] = float(rho)
346
+ results["vP"] = float(vP)
347
+ results["vS"] = float(vS)
348
+ results["vP/vS"] = float(vPvS)
349
+ results["K"] = float(bulk_modulus)
350
+ results["G"] = float(shear_modulus)
351
+ results["E"] = float(youngs_modulus)
352
+ results["nu"] = float(poisson_ratio)
353
+ results["GR"] = float(gamma_ray)
354
+ results["PE"] = float(photoelectricity)
355
+ #
356
+ return results
357
+ #
358
+ def create_dolostone(self, number=1, composition=None, porosity=None):
359
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
360
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
361
+ data_illite = Phyllosilicates(impurity="pure", data_type=True).create_illite()
362
+ #
363
+ mineralogy = {"Cal": self.data_calcite, "Dol": self.data_dolomite, "Qz": self.data_quartz,
364
+ "Kfs": data_alkalifeldspar, "Pl": data_plagioclase, "Kln": self.data_kaolinite,
365
+ "Ilt": data_illite, "Py": self.data_pyrite}
366
+ #
367
+ amounts_mineralogy = {}
368
+ amounts_chemistry = {}
369
+ amounts_compounds = {}
370
+ bulk_properties = {}
371
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
372
+ for property in properties:
373
+ bulk_properties[property] = []
374
+ mineral_list = []
375
+ elements = []
376
+ for mineral, dataset in mineralogy.items():
377
+ amounts_mineralogy[dataset["mineral"]] = []
378
+ mineral_list.append(dataset["mineral"])
379
+ elements_mineral = list(dataset["chemistry"].keys())
380
+ for element in elements_mineral:
381
+ if element not in elements:
382
+ elements.append(element)
383
+ amounts_chemistry[element] = []
384
+ mineral_list.sort()
385
+ elements.sort()
386
+ #
387
+ n = 0
388
+ while n < number:
389
+ condition = False
390
+ while condition == False:
391
+ elements_list = []
392
+ phi_minerals = {}
393
+ w_minerals = {}
394
+ w_elements = {}
395
+ #
396
+ if composition != None:
397
+ phi_cal = composition["Cal"]
398
+ phi_dol = composition["Dol"]
399
+ phi_qz = composition["Qz"]
400
+ phi_kfs = composition["Kfs"]
401
+ phi_pl = composition["Pl"]
402
+ phi_kln = composition["Kln"]
403
+ phi_ilt = composition["Ilt"]
404
+ phi_py = composition["Py"]
405
+ #
406
+ phi_minerals["Cal"] = phi_cal
407
+ phi_minerals["Dol"] = phi_dol
408
+ phi_minerals["Qz"] = phi_qz
409
+ phi_minerals["Kfs"] = phi_kfs
410
+ phi_minerals["Pl"] = phi_pl
411
+ phi_minerals["Kln"] = phi_kln
412
+ phi_minerals["Ilt"] = phi_ilt
413
+ phi_minerals["Py"] = phi_py
414
+ #
415
+ else:
416
+ condition_2 = False
417
+ while condition_2 == False:
418
+ magicnumber = rd.randint(0, 12)
419
+ if 0 <= magicnumber <= 8: # Carbonate-dominated
420
+ w_carb = round(rd.uniform(0.8, 1.0), 4)
421
+ w_clast = round(rd.uniform(0.0, (1.0 - w_carb)), 4)
422
+ w_clay = round(rd.uniform(0.0, (1.0 - w_carb - w_clast)), 4)
423
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
424
+ #
425
+ phi_dol = round(w_carb*rd.uniform(0.9, 1.0), 4)
426
+ phi_cal = round(w_carb - phi_dol, 4)
427
+ #
428
+ phi_qz = round(w_clast*rd.uniform(0.8, 1.0), 4)
429
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
430
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
431
+ #
432
+ magicnumber_2 = rd.randint(0, 1)
433
+ if magicnumber_2 == 0:
434
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
435
+ phi_ilt = round(w_clay - phi_kln, 4)
436
+ else:
437
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
438
+ phi_kln = round(w_clay - phi_ilt, 4)
439
+ #
440
+ phi_py = round(w_sulf, 4)
441
+ #
442
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
443
+ #
444
+ elif magicnumber in [9, 10]: # Clastic-dominated
445
+ w_clast = round(rd.uniform(0.15, 0.3), 4)
446
+ w_carb = round(rd.uniform(0.7, (1.0 - w_clast)), 4)
447
+ w_clay = round(rd.uniform(0.0, (1.0 - w_carb - w_clast)), 4)
448
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
449
+ #
450
+ phi_qz = round(w_clast*rd.uniform(0.8, 1.0), 4)
451
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
452
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
453
+ #
454
+ phi_dol = round(w_carb*rd.uniform(0.9, 1.0), 4)
455
+ phi_cal = round(w_carb - phi_dol, 4)
456
+ #
457
+ magicnumber_2 = rd.randint(0, 1)
458
+ if magicnumber_2 == 0:
459
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
460
+ phi_ilt = round(w_clay - phi_kln, 4)
461
+ else:
462
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
463
+ phi_kln = round(w_clay - phi_ilt, 4)
464
+ #
465
+ phi_py = round(w_sulf, 4)
466
+ #
467
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
468
+ #
469
+ elif magicnumber in [11, 12]: # Clay-dominated
470
+ w_clay = round(rd.uniform(0.15, 0.3), 4)
471
+ w_carb = round(rd.uniform(0.7, (1.0 - w_clay)), 4)
472
+ w_clast = round(rd.uniform(0.0, (1.0 - w_carb - w_clay)), 4)
473
+ w_sulf = round(1 - w_carb - w_clast - w_clay, 4)
474
+ #
475
+ phi_dol = round(w_carb*rd.uniform(0.9, 1.0), 4)
476
+ phi_cal = round(w_carb - phi_dol, 4)
477
+ #
478
+ phi_qz = round(w_clast*rd.uniform(0.8, 1.0), 4)
479
+ phi_pl = round(w_clast*rd.uniform(0.0, (1.0 - phi_qz)), 4)
480
+ phi_kfs = round(w_clast - phi_qz - phi_pl, 4)
481
+ #
482
+ magicnumber_2 = rd.randint(0, 1)
483
+ if magicnumber_2 == 0:
484
+ phi_kln = round(w_clay*rd.uniform(0.9, 1.0), 4)
485
+ phi_ilt = round(w_clay - phi_kln, 4)
486
+ else:
487
+ phi_ilt = round(w_clay*rd.uniform(0.9, 1.0), 4)
488
+ phi_kln = round(w_clay - phi_ilt, 4)
489
+ #
490
+ phi_py = round(w_sulf, 4)
491
+ #
492
+ phi_total = phi_cal + phi_dol + phi_qz + phi_kfs + phi_pl + phi_kln + phi_ilt + phi_py
493
+ #
494
+ if np.isclose(phi_total, 1.0000) == True:
495
+ if 0.8 <= phi_dol <= 1.0 and 0.0 <= phi_cal <= 0.2 and 0.0 <= phi_qz <= 0.3 \
496
+ and 0.0 <= phi_kfs <= 0.2 and 0.0 <= phi_pl <= 0.2 \
497
+ and 0.0 <= phi_kln <= 0.3 and 0.0 <= phi_ilt <= 0.3 and 0.0 <= phi_py <= 0.05:
498
+ condition_2 = True
499
+ #
500
+ phi_minerals["Cal"] = abs(phi_cal)
501
+ phi_minerals["Dol"] = abs(phi_dol)
502
+ phi_minerals["Qz"] = abs(phi_qz)
503
+ phi_minerals["Kfs"] = abs(phi_kfs)
504
+ phi_minerals["Pl"] = abs(phi_pl)
505
+ phi_minerals["Kln"] = abs(phi_kln)
506
+ phi_minerals["Ilt"] = abs(phi_ilt)
507
+ phi_minerals["Py"] = abs(phi_py)
508
+ #
509
+ rho_s = 0
510
+ for key, value in phi_minerals.items():
511
+ rho_s += value*mineralogy[key]["rho"]
512
+ for element, value in mineralogy[key]["chemistry"].items():
513
+ if element not in elements_list:
514
+ elements_list.append(element)
515
+ w_elements[element] = 0.0
516
+ #
517
+ rho_s = round(rho_s, 3)
518
+ #
519
+ for key, value in phi_minerals.items():
520
+ w_result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, 4)
521
+ w_minerals[key] = w_result
522
+ #
523
+ if porosity == None:
524
+ phi_helper = round(rd.uniform(0.0, 0.4), 4)
525
+ else:
526
+ phi_helper = round(rd.uniform(porosity[0], porosity[1]), 4)
527
+ #
528
+ #rho = round((1 - phi_helper)*rho_s + phi_helper*self.data_water[2], 3)
529
+ #
530
+ old_index = elements_list.index("O")
531
+ elements_list += [elements_list.pop(old_index)]
532
+ #
533
+ w_elements_total = 0.0
534
+ for element in elements_list:
535
+ if element != "O":
536
+ for mineral, w_mineral in w_minerals.items():
537
+ if element in mineralogy[mineral]["chemistry"]:
538
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], 4)
539
+ w_elements[element] += value
540
+ w_elements_total += value
541
+ #
542
+ w_elements[element] = round(w_elements[element], 4)
543
+ elif element == "O":
544
+ w_elements[element] += round(1 - w_elements_total, 4)
545
+ #
546
+ w_elements[element] = round(w_elements[element], 4)
547
+ #
548
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
549
+ #
550
+ condition = True
551
+ #
552
+ bulk_mod = 0.0
553
+ shear_mod = 0.0
554
+ gamma_ray = 0.0
555
+ photoelectricity = 0.0
556
+ for key, value in phi_minerals.items():
557
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
558
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
559
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
560
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
561
+ #
562
+ bulk_mod = round(bulk_mod, 3)
563
+ shear_mod = round(shear_mod, 3)
564
+ gamma_ray = round(gamma_ray, 3)
565
+ photoelectricity = round(photoelectricity, 3)
566
+ #
567
+ ## Bulk Density, Porosity, Seismic Velocities
568
+ rho_solid = round(rho_s, 3)
569
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
570
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
571
+ rho_limits=[2000, 2950], vP_limits=[3500, 7000], vS_limits=[2200, 3200], delta=0.05,
572
+ porosity=porosity)
573
+ ## Elastic Parameters
574
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
575
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
576
+ rho=rho, vP=vP, vS=vS)
577
+ #
578
+ for mineral, value in w_minerals.items():
579
+ amounts_mineralogy[mineral].append(value)
580
+ for element, value in w_elements.items():
581
+ amounts_chemistry[element].append(value)
582
+ #
583
+ bulk_properties["rho_s"].append(rho_solid)
584
+ bulk_properties["rho"].append(rho)
585
+ bulk_properties["phi"].append(var_porosity)
586
+ bulk_properties["K"].append(bulk_modulus)
587
+ bulk_properties["G"].append(shear_modulus)
588
+ bulk_properties["E"].append(youngs_modulus)
589
+ bulk_properties["nu"].append(poisson_ratio)
590
+ bulk_properties["vP"].append(vP)
591
+ bulk_properties["vS"].append(vS)
592
+ bulk_properties["vPvS"].append(vPvS)
593
+ bulk_properties["GR"].append(gamma_ray)
594
+ bulk_properties["PE"].append(photoelectricity)
595
+
596
+ amounts = []
597
+ for key, value in w_elements.items():
598
+ amounts_chemistry[key].append(value)
599
+ chem_data = PeriodicSystem(name=key).get_data()
600
+ amounts.append([key, chem_data[1], value])
601
+
602
+ list_oxides = ["H2O", "CO2", "Na2O", "MgO", "Al2O3", "SiO2", "SO3", "K2O", "CaO", "Fe2O3"]
603
+ composition_oxides = {}
604
+ for var_oxide in list_oxides:
605
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
606
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
607
+
608
+ if list_oxides[0] not in amounts_compounds:
609
+ for oxide in list_oxides:
610
+ amounts_compounds[oxide] = []
611
+
612
+ for key, value in composition_oxides.items():
613
+ amounts_compounds[key].append(value)
614
+
615
+ n += 1
616
+
617
+ amounts_mineralogy = dict(sorted(
618
+ amounts_mineralogy.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
619
+ amounts_chemistry = dict(sorted(
620
+ amounts_chemistry.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
621
+ amounts_compounds = dict(sorted(
622
+ amounts_compounds.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
623
+
624
+ ## EXPORT DATA
625
+ results = {}
626
+ results["rock"] = "Dolostone"
627
+ if number > 1:
628
+ results["mineralogy"] = amounts_mineralogy
629
+ results["chemistry"] = amounts_chemistry
630
+ results["compounds"] = amounts_compounds
631
+ results["phi"] = bulk_properties["phi"]
632
+ results["fluid"] = "water"
633
+ results["rho_s"] = bulk_properties["rho_s"]
634
+ results["rho"] = bulk_properties["rho"]
635
+ results["vP"] = bulk_properties["vP"]
636
+ results["vS"] = bulk_properties["vS"]
637
+ results["vP/vS"] = bulk_properties["vPvS"]
638
+ results["K"] = bulk_properties["K"]
639
+ results["G"] = bulk_properties["G"]
640
+ results["E"] = bulk_properties["E"]
641
+ results["nu"] = bulk_properties["nu"]
642
+ results["GR"] = bulk_properties["GR"]
643
+ results["PE"] = bulk_properties["PE"]
644
+ else:
645
+ single_amounts_mineralogy = {}
646
+ single_amounts_chemistry = {}
647
+ single_amounts_compounds = {}
648
+ for mineral, value in w_minerals.items():
649
+ single_amounts_mineralogy[mineral] = value
650
+ for element, value in w_elements.items():
651
+ single_amounts_chemistry[element] = value
652
+ for compound, value in amounts_compounds.items():
653
+ single_amounts_compounds[compound] = value[0]
654
+ results["mineralogy"] = single_amounts_mineralogy
655
+ results["chemistry"] = single_amounts_chemistry
656
+ results["compounds"] = single_amounts_compounds
657
+ results["phi"] = var_porosity
658
+ results["fluid"] = "water"
659
+ results["rho_s"] = rho_solid
660
+ results["rho"] = rho
661
+ results["vP"] = vP
662
+ results["vS"] = vS
663
+ results["vP/vS"] = vPvS
664
+ results["K"] = bulk_modulus
665
+ results["G"] = shear_modulus
666
+ results["E"] = youngs_modulus
667
+ results["nu"] = poisson_ratio
668
+ results["GR"] = gamma_ray
669
+ results["PE"] = photoelectricity
670
+ #
671
+ return results
672
+
673
+ def create_marl(self, rock="Marl", number=1, composition=None, classification="Marl", porosity=None):
674
+ #
675
+ results_container = {}
676
+ results_container["rock"] = rock
677
+ results_container["mineralogy"] = {}
678
+ results_container["chemistry"] = {}
679
+ results_container["compounds"] = {}
680
+ results_container["phi"] = []
681
+ results_container["fluid"] = self.fluid
682
+ results_container["rho_s"] = []
683
+ results_container["rho"] = []
684
+ results_container["vP"] = []
685
+ results_container["vS"] = []
686
+ results_container["vP/vS"] = []
687
+ results_container["K"] = []
688
+ results_container["G"] = []
689
+ results_container["E"] = []
690
+ results_container["nu"] = []
691
+ results_container["GR"] = []
692
+ results_container["PE"] = []
693
+ #
694
+ n = 0
695
+ while n < number:
696
+ data_illite = Phyllosilicates(impurity="pure", data_type=True).create_illite()
697
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
698
+ #
699
+ mineralogy = {"Cal": self.data_calcite, "Ilt": data_illite, "Pl": data_plagioclase}
700
+ #
701
+ minerals_list = list(mineralogy.keys())
702
+ #
703
+ if minerals_list[0] not in results_container["mineralogy"]:
704
+ for mineral in minerals_list:
705
+ results_container["mineralogy"][mineral] = []
706
+ #
707
+ condition = False
708
+ #
709
+ while condition == False:
710
+ elements_list = []
711
+ phi_minerals = {}
712
+ w_minerals = {}
713
+ w_elements = {}
714
+ #
715
+ if composition != None:
716
+ phi_cal = composition["Cal"]
717
+ phi_ilt = composition["Ilt"]
718
+ phi_pl = composition["Pl"]
719
+ #
720
+ phi_minerals["Cal"] = phi_cal
721
+ phi_minerals["Ilt"] = phi_ilt
722
+ phi_minerals["Pl"] = phi_pl
723
+ #
724
+ else:
725
+ condition_2 = False
726
+ while condition_2 == False:
727
+ if classification == "Marl":
728
+ cal_limits = [0.35, 0.65]
729
+ ilt_limits = [0.35, 0.65]
730
+ pl_limits = [0.0, 0.3]
731
+ #
732
+ phi_cal = round(rd.uniform(cal_limits[0], cal_limits[1]), 4)
733
+ phi_ilt = round(rd.uniform(ilt_limits[0], (1 - phi_cal)), 4)
734
+ phi_pl = round(1 - phi_cal - phi_ilt, 4)
735
+ #
736
+ phi_total = phi_cal + phi_ilt + phi_pl
737
+ #
738
+ if np.isclose(phi_total, 1.0000) == True:
739
+ if cal_limits[0] <= phi_cal <= cal_limits[1] \
740
+ and ilt_limits[0] <= phi_ilt <= ilt_limits[1] \
741
+ and pl_limits[0] <= phi_pl <= pl_limits[1]:
742
+ condition_2 = True
743
+ #
744
+ phi_minerals["Cal"] = phi_cal
745
+ phi_minerals["Ilt"] = phi_ilt
746
+ phi_minerals["Pl"] = phi_pl
747
+ #
748
+ rho_s = 0
749
+ for key, value in phi_minerals.items():
750
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
751
+ #
752
+ for element, value in mineralogy[key]["chemistry"].items():
753
+ if element not in elements_list:
754
+ elements_list.append(element)
755
+ w_elements[element] = 0.0
756
+ #
757
+ if elements_list[0] not in results_container["chemistry"]:
758
+ for element in elements_list:
759
+ results_container["chemistry"][element] = []
760
+ #
761
+ rho_s = round(rho_s, 3)
762
+ for key, value in phi_minerals.items():
763
+ if key == "Urn":
764
+ n_digits = 4
765
+ else:
766
+ n_digits = 4
767
+ #
768
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
769
+ #
770
+ if porosity == None:
771
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
772
+ elif type(porosity) == float:
773
+ var_porosity = porosity
774
+ else:
775
+ var_porosity = round(rd.uniform(porosity[0], porosity[1]), 4)
776
+ #
777
+ if self.fluid == "water":
778
+ data_fluid = self.data_water
779
+ #
780
+ old_index = elements_list.index("O")
781
+ elements_list += [elements_list.pop(old_index)]
782
+ #
783
+ w_elements_total = 0.0
784
+ for element in elements_list:
785
+ if element != "O":
786
+ for mineral, w_mineral in w_minerals.items():
787
+ if element in mineralogy[mineral]["chemistry"]:
788
+ if element == "U":
789
+ n_digits = 4
790
+ else:
791
+ n_digits = 4
792
+ #
793
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
794
+ w_elements[element] += value
795
+ w_elements_total += value
796
+ #
797
+ w_elements[element] = round(w_elements[element], n_digits)
798
+ elif element == "O":
799
+ w_elements[element] += round(1 - w_elements_total, 4)
800
+ #
801
+ w_elements[element] = round(w_elements[element], 4)
802
+ #
803
+ total_w_minerals = round(sum(w_minerals.values()), 4)
804
+ total_w_elements = round(sum(w_elements.values()), 4)
805
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
806
+ for key, value in w_minerals.items():
807
+ w_minerals[key] = abs(value)
808
+ #
809
+ for key, value in w_elements.items():
810
+ w_elements[key] = abs(value)
811
+ #
812
+ condition = True
813
+ #
814
+ rho_solid = 0
815
+ velocity_solid = {"vP": 0, "vS": 0}
816
+ gamma_ray = 0.0
817
+ photoelectricity = 0.0
818
+ for key, value in phi_minerals.items():
819
+ rho_solid += phi_minerals[key]*mineralogy[key]["rho"]
820
+ velocity_solid["vP"] += phi_minerals[key]*mineralogy[key]["vP"]
821
+ velocity_solid["vS"] += phi_minerals[key]*mineralogy[key]["vS"]
822
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
823
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
824
+ #
825
+ ## Bulk Density, Porosity, Seismic Velocities
826
+ rho_solid = round(rho_s, 3)
827
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
828
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
829
+ rho_limits=[2200, 2700], vP_limits=[1800, 3200], vS_limits=[1000, 2000], delta=0.05,
830
+ porosity=porosity)
831
+ ## Elastic Parameters
832
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
833
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
834
+ rho=rho, vP=vP, vS=vS)
835
+ ## Gamma Ray
836
+ gamma_ray = round(gamma_ray, 3)
837
+ ## Photoelectricity
838
+ photoelectricity = round(photoelectricity, 3)
839
+ # Composition data
840
+ for key, value in w_minerals.items():
841
+ results_container["mineralogy"][key].append(value)
842
+
843
+ amounts = []
844
+ for key, value in w_elements.items():
845
+ results_container["chemistry"][key].append(value)
846
+ chem_data = PeriodicSystem(name=key).get_data()
847
+ amounts.append([key, chem_data[1], value])
848
+
849
+ list_oxides = ["H2O", "CO2", "Na2O", "Al2O3", "SiO2", "K2O", "CaO"]
850
+ composition_oxides = {}
851
+ for var_oxide in list_oxides:
852
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
853
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
854
+
855
+ if list_oxides[0] not in results_container["compounds"]:
856
+ for oxide in list_oxides:
857
+ results_container["compounds"][oxide] = []
858
+
859
+ for key, value in composition_oxides.items():
860
+ results_container["compounds"][key].append(value)
861
+
862
+ results_container["mineralogy"] = dict(sorted(
863
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
864
+ results_container["chemistry"] = dict(sorted(
865
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
866
+ results_container["compounds"] = dict(sorted(
867
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
868
+
869
+ # Results
870
+ results_container["phi"].append(var_porosity)
871
+ results_container["rho_s"].append(rho_s)
872
+ results_container["rho"].append(rho)
873
+ results_container["vP"].append(vP)
874
+ results_container["vS"].append(vS)
875
+ results_container["vP/vS"].append(vPvS)
876
+ results_container["K"].append(bulk_modulus)
877
+ results_container["G"].append(shear_modulus)
878
+ results_container["E"].append(youngs_modulus)
879
+ results_container["nu"].append(poisson_ratio)
880
+ results_container["GR"].append(gamma_ray)
881
+ results_container["PE"].append(photoelectricity)
882
+ #
883
+ n += 1
884
+ #
885
+ return results_container
886
+
887
+ # Carbonates
888
+ class Carbonates:
889
+ """ Class that generates geophysical and geochemical data of carbonate minerals"""
890
+ #
891
+ def __init__(self, traces_list=[], impurity="pure", data_type=False, mineral=None):
892
+ self.traces_list = traces_list
893
+ self.impurity = impurity
894
+ self.data_type = data_type
895
+ self.mineral = mineral
896
+ #
897
+ def get_data(self, number=1):
898
+ if self.mineral in ["Cal", "Calcite"]:
899
+ if number > 1:
900
+ data = [self.create_calcite() for n in range(number)]
901
+ else:
902
+ data = self.create_calcite()
903
+ elif self.mineral in ["Dol", "Dolomite"]:
904
+ if number > 1:
905
+ data = [self.create_dolomite() for n in range(number)]
906
+ else:
907
+ data = self.create_dolomite()
908
+ elif self.mineral in ["Mgs", "Magnesite"]:
909
+ if number > 1:
910
+ data = [self.create_magnesite() for n in range(number)]
911
+ else:
912
+ data = self.create_magnesite()
913
+ elif self.mineral in ["Sd", "Siderite"]:
914
+ if number > 1:
915
+ data = [self.create_siderite() for n in range(number)]
916
+ else:
917
+ data = self.create_siderite()
918
+ elif self.mineral in ["Org", "Organic Matter"]:
919
+ if number > 1:
920
+ data = [self.create_organic_matter() for n in range(number)]
921
+ else:
922
+ data = self.create_organic_matter()
923
+ elif self.mineral in ["Rdc", "Rhodochrosite"]:
924
+ if number > 1:
925
+ data = [self.create_rhodochrosite() for n in range(number)]
926
+ else:
927
+ data = self.create_rhodochrosite()
928
+ elif self.mineral in ["Arg", "Aragonite"]:
929
+ if number > 1:
930
+ data = [self.create_aragonite() for n in range(number)]
931
+ else:
932
+ data = self.create_aragonite()
933
+ elif self.mineral in ["Cer", "Cerussite"]:
934
+ if number > 1:
935
+ data = [self.create_cerussite() for n in range(number)]
936
+ else:
937
+ data = self.create_cerussite()
938
+ elif self.mineral in ["Ank", "Ankerite"]:
939
+ if number > 1:
940
+ data = [self.create_ankerite() for n in range(number)]
941
+ else:
942
+ data = self.create_ankerite()
943
+ elif self.mineral in ["Az", "Azurite"]:
944
+ if number > 1:
945
+ data = [self.create_azurite() for n in range(number)]
946
+ else:
947
+ data = self.create_azurite()
948
+ elif self.mineral in ["Mal", "Malachite"]:
949
+ if number > 1:
950
+ data = [self.create_malachite() for n in range(number)]
951
+ else:
952
+ data = self.create_malachite()
953
+ #
954
+ return data
955
+ #
956
+ def generate_dataset(self, number):
957
+ dataset = {}
958
+ #
959
+ for index in range(number):
960
+ if self.mineral == "Calcite":
961
+ data_mineral = self.create_calcite()
962
+ elif self.mineral == "Dolomite":
963
+ data_mineral = self.create_dolomite()
964
+ elif self.mineral == "Magnesite":
965
+ data_mineral = self.create_magnesite()
966
+ elif self.mineral == "Siderite":
967
+ data_mineral = self.create_siderite()
968
+ elif self.mineral == "Rhodochrosite":
969
+ data_mineral = self.create_rhodochrosite()
970
+ elif self.mineral == "Aragonite":
971
+ data_mineral = self.create_aragonite()
972
+ elif self.mineral == "Cerrusite":
973
+ data_mineral = self.create_cerussite()
974
+ elif self.mineral == "Ankerite":
975
+ data_mineral = self.create_ankerite()
976
+ elif self.mineral == "Azurite":
977
+ data_mineral = self.create_azurite()
978
+ elif self.mineral == "Malachite":
979
+ data_mineral = self.create_malachite()
980
+ elif self.mineral == "Ikaite":
981
+ data_mineral = self.create_ikaite()
982
+ elif self.mineral == "Smithsonite":
983
+ data_mineral = self.create_smithsonite()
984
+ #
985
+ for key, value in data_mineral.items():
986
+ if key in ["M", "rho", "rho_e", "V", "vP", "vS", "vP/vS", "K", "G", "E", "nu", "GR", "PE", "U",
987
+ "p"]:
988
+ if key not in dataset:
989
+ dataset[key] = [value]
990
+ else:
991
+ dataset[key].append(value)
992
+ elif key in ["mineral", "state", "trace elements"] and key not in dataset:
993
+ dataset[key] = value
994
+ elif key in ["chemistry"]:
995
+ if key not in dataset:
996
+ dataset[key] = {}
997
+ for key_2, value_2 in value.items():
998
+ dataset[key][key_2] = [value_2]
999
+ else:
1000
+ for key_2, value_2 in value.items():
1001
+ dataset[key][key_2].append(value_2)
1002
+ #
1003
+ return dataset
1004
+ #
1005
+ def create_calcite(self): # CaCO3
1006
+ # Major elements
1007
+ carbon = PeriodicSystem(name="C").get_data()
1008
+ oxygen = PeriodicSystem(name="O").get_data()
1009
+ calcium = PeriodicSystem(name="Ca").get_data()
1010
+ majors_name = ["C", "O", "Ca"]
1011
+ majors_data = np.array([["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]],
1012
+ ["Ca", calcium[1], 1, calcium[2]]], dtype=object)
1013
+ # Minor elements
1014
+ traces_data = []
1015
+ if len(self.traces_list) > 0:
1016
+ self.impurity = "impure"
1017
+ if self.impurity == "pure":
1018
+ var_state = "fixed"
1019
+ else:
1020
+ var_state = "variable"
1021
+ if self.impurity == "random":
1022
+ self.traces_list = []
1023
+ minors = ["Mn", "Fe", "Zn", "Co", "Ba", "Sr", "Pb", "Mg", "Cu", "Al", "Ni", "V", "Cr", "Mo"]
1024
+ n = rd.randint(1, len(minors))
1025
+ while len(self.traces_list) < n:
1026
+ selection = rd.choice(minors)
1027
+ if selection not in self.traces_list and selection not in majors_name:
1028
+ self.traces_list.append(selection)
1029
+ else:
1030
+ continue
1031
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1032
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1033
+ for i in range(len(self.traces_list)):
1034
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1035
+ if len(traces_data) > 0:
1036
+ traces_data = np.array(traces_data, dtype=object)
1037
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1038
+ #
1039
+ data = []
1040
+ mineral = "Cal"
1041
+ #
1042
+ # Molar mass
1043
+ molar_mass_pure = calcium[2] + carbon[2] + 3*oxygen[2]
1044
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1045
+ majors=majors_data).calculate_molar_mass()
1046
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1047
+ # Density
1048
+ dataV = CrystalPhysics([[4.99, 17.06], [], "trigonal"])
1049
+ V = dataV.calculate_volume()
1050
+ Z = 6
1051
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1052
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1053
+ rho = dataRho.calculate_bulk_density()
1054
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1055
+ # Bulk modulus
1056
+ K = 76*10**9
1057
+ # Shear modulus
1058
+ G = 32*10**9
1059
+ # Young's modulus
1060
+ E = (9*K*G)/(3*K + G)
1061
+ # Poisson's ratio
1062
+ nu = (3*K - 2*G)/(2*(3*K + G))
1063
+ # vP/vS
1064
+ vPvS = ((K + 4/3*G)/G)**0.5
1065
+ # P-wave velocity
1066
+ vP = ((K + 4/3*G)/rho)**0.5
1067
+ # S-wave velocity
1068
+ vS = (G/rho)**0.5
1069
+ # Gamma ray
1070
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1071
+ # Photoelectricity
1072
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1073
+ U = pe*rho_e*10**(-3)
1074
+ # Electrical resistivity
1075
+ p = 2*10**12
1076
+ #
1077
+ if self.data_type == False:
1078
+ data.append(mineral)
1079
+ data.append(round(molar_mass, 3))
1080
+ data.append(round(rho, 2))
1081
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1082
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1083
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1084
+ data.append(amounts)
1085
+ #
1086
+ return data
1087
+ else:
1088
+ #
1089
+ results = {}
1090
+ results["mineral"] = mineral
1091
+ results["state"] = var_state
1092
+ results["M"] = molar_mass
1093
+ element_list = np.array(amounts)[:, 0]
1094
+ results["chemistry"] = {}
1095
+ for index, element in enumerate(element_list, start=0):
1096
+ results["chemistry"][element] = amounts[index][2]
1097
+ results["rho"] = round(rho, 4)
1098
+ results["rho_e"] = round(rho_e, 4)
1099
+ results["V"] = round(V_m, 4)
1100
+ results["vP"] = round(vP, 4)
1101
+ results["vS"] = round(vS, 4)
1102
+ results["vP/vS"] = round(vPvS, 4)
1103
+ results["G"] = round(G*10**(-9), 4)
1104
+ results["K"] = round(K*10**(-9), 4)
1105
+ results["E"] = round(E*10**(-9), 4)
1106
+ results["nu"] = round(nu, 4)
1107
+ results["GR"] = round(gamma_ray, 4)
1108
+ results["PE"] = round(pe, 4)
1109
+ results["U"] = round(U, 4)
1110
+ if p != None:
1111
+ results["p"] = round(p, 4)
1112
+ else:
1113
+ results["p"] = p
1114
+ #
1115
+ return results
1116
+ #
1117
+ def create_dolomite(self): # CaMg(CO3)2
1118
+ # Major elements
1119
+ carbon = PeriodicSystem(name="C").get_data()
1120
+ oxygen = PeriodicSystem(name="O").get_data()
1121
+ magnesium = PeriodicSystem(name="Mg").get_data()
1122
+ calcium = PeriodicSystem(name="Ca").get_data()
1123
+ majors_name = ["C", "O", "Mg", "Ca"]
1124
+ majors_data = np.array([["C", carbon[1], 2, carbon[2]], ["O", oxygen[1], 6, oxygen[2]],
1125
+ ["Mg", magnesium[1], 1, magnesium[2]], ["Ca", calcium[1], 1, calcium[2]]], dtype=object)
1126
+ # Minor elements
1127
+ traces_data = []
1128
+ if len(self.traces_list) > 0:
1129
+ self.impurity = "impure"
1130
+ if self.impurity == "pure":
1131
+ var_state = "fixed"
1132
+ else:
1133
+ var_state = "variable"
1134
+ if self.impurity == "random":
1135
+ self.traces_list = []
1136
+ minors = ["Fe", "Mn", "Co", "Pb", "Zn"]
1137
+ n = rd.randint(1, len(minors))
1138
+ while len(self.traces_list) < n:
1139
+ selection = rd.choice(minors)
1140
+ if selection not in self.traces_list and selection not in majors_name:
1141
+ self.traces_list.append(selection)
1142
+ else:
1143
+ continue
1144
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1145
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1146
+ for i in range(len(self.traces_list)):
1147
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1148
+ if len(traces_data) > 0:
1149
+ traces_data = np.array(traces_data, dtype=object)
1150
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1151
+ #
1152
+ data = []
1153
+ mineral = "Dol"
1154
+ #
1155
+ # Molar mass
1156
+ molar_mass_pure = calcium[2] + magnesium[2] + 2*(carbon[2] + 3*oxygen[2])
1157
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1158
+ majors=majors_data).calculate_molar_mass()
1159
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1160
+ # Density
1161
+ dataV = CrystalPhysics([[4.81, 16.01], [], "trigonal"])
1162
+ V = dataV.calculate_volume()
1163
+ Z = 3
1164
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1165
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1166
+ rho = dataRho.calculate_bulk_density()
1167
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1168
+ # Bulk modulus
1169
+ K = 89*10**9
1170
+ # Shear modulus
1171
+ G = 44*10**9
1172
+ # Young's modulus
1173
+ E = (9*K*G)/(3*K + G)
1174
+ # Poisson's ratio
1175
+ nu = (3*K - 2*G)/(2*(3*K + G))
1176
+ # vP/vS
1177
+ vPvS = ((K + 4/3*G)/G)**0.5
1178
+ # P-wave velocity
1179
+ vP = ((K + 4/3*G)/rho)**0.5
1180
+ # S-wave velocity
1181
+ vS = (G/rho)**0.5
1182
+ # Gamma ray
1183
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1184
+ # Photoelectricity
1185
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1186
+ U = pe*rho_e*10**(-3)
1187
+ # Electrical resistivity
1188
+ p = 5*10**3
1189
+ #
1190
+ if self.data_type == False:
1191
+ data.append(mineral)
1192
+ data.append(round(molar_mass, 3))
1193
+ data.append(round(rho, 2))
1194
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1195
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1196
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1197
+ data.append(amounts)
1198
+ #
1199
+ return data
1200
+ else:
1201
+ #
1202
+ results = {}
1203
+ results["mineral"] = mineral
1204
+ results["state"] = var_state
1205
+ results["M"] = molar_mass
1206
+ element_list = np.array(amounts)[:, 0]
1207
+ results["chemistry"] = {}
1208
+ for index, element in enumerate(element_list, start=0):
1209
+ results["chemistry"][element] = amounts[index][2]
1210
+ results["rho"] = round(rho, 4)
1211
+ results["rho_e"] = round(rho_e, 4)
1212
+ results["V"] = round(V_m, 4)
1213
+ results["vP"] = round(vP, 4)
1214
+ results["vS"] = round(vS, 4)
1215
+ results["vP/vS"] = round(vPvS, 4)
1216
+ results["G"] = round(G*10**(-9), 4)
1217
+ results["K"] = round(K*10**(-9), 4)
1218
+ results["E"] = round(E*10**(-9), 4)
1219
+ results["nu"] = round(nu, 4)
1220
+ results["GR"] = round(gamma_ray, 4)
1221
+ results["PE"] = round(pe, 4)
1222
+ results["U"] = round(U, 4)
1223
+ if p != None:
1224
+ results["p"] = round(p, 4)
1225
+ else:
1226
+ results["p"] = p
1227
+ #
1228
+ return results
1229
+ #
1230
+ def create_magnesite(self): # Mg(CO3)
1231
+ # Major elements
1232
+ carbon = PeriodicSystem(name="C").get_data()
1233
+ oxygen = PeriodicSystem(name="O").get_data()
1234
+ magnesium = PeriodicSystem(name="Mg").get_data()
1235
+ majors_name = ["C", "O", "Mg"]
1236
+ majors_data = np.array([["C", carbon[1], 2, carbon[2]], ["O", oxygen[1], 6, oxygen[2]],
1237
+ ["Mg", magnesium[1], 1, magnesium[2]]], dtype=object)
1238
+ # Minor elements
1239
+ traces_data = []
1240
+ if len(self.traces_list) > 0:
1241
+ self.impurity = "impure"
1242
+ if self.impurity == "pure":
1243
+ var_state = "fixed"
1244
+ else:
1245
+ var_state = "variable"
1246
+ if self.impurity == "random":
1247
+ self.traces_list = []
1248
+ minors = ["Fe", "Mn", "Ca", "Co", "Ni"]
1249
+ n = rd.randint(1, len(minors))
1250
+ while len(self.traces_list) < n:
1251
+ selection = rd.choice(minors)
1252
+ if selection not in self.traces_list and selection not in majors_name:
1253
+ self.traces_list.append(selection)
1254
+ else:
1255
+ continue
1256
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1257
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1258
+ for i in range(len(self.traces_list)):
1259
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1260
+ if len(traces_data) > 0:
1261
+ traces_data = np.array(traces_data, dtype=object)
1262
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1263
+ #
1264
+ data = []
1265
+ mineral = "Mgs"
1266
+ #
1267
+ # Molar mass
1268
+ molar_mass_pure = magnesium[2] + (carbon[2] + 3*oxygen[2])
1269
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1270
+ majors=majors_data).calculate_molar_mass()
1271
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1272
+ # Density
1273
+ dataV = CrystalPhysics([[4.63, 15.03], [], "trigonal"])
1274
+ V = dataV.calculate_volume()
1275
+ Z = 6
1276
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1277
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1278
+ rho = dataRho.calculate_bulk_density()
1279
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1280
+ # Bulk modulus
1281
+ K = 105*10**9
1282
+ # Shear modulus
1283
+ G = 63*10**9
1284
+ # Young's modulus
1285
+ E = (9*K*G)/(3*K + G)
1286
+ # Poisson's ratio
1287
+ nu = (3*K - 2*G)/(2*(3*K + G))
1288
+ # vP/vS
1289
+ vPvS = ((K + 4/3*G)/G)**0.5
1290
+ # P-wave velocity
1291
+ vP = ((K + 4/3*G)/rho)**0.5
1292
+ # S-wave velocity
1293
+ vS = (G/rho)**0.5
1294
+ # Gamma ray
1295
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1296
+ # Photoelectricity
1297
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1298
+ U = pe*rho_e*10**(-3)
1299
+ # Electrical resistivity
1300
+ p = None
1301
+ #
1302
+ if self.data_type == False:
1303
+ data.append(mineral)
1304
+ data.append(round(molar_mass, 3))
1305
+ data.append(round(rho, 2))
1306
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1307
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1308
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1309
+ data.append(amounts)
1310
+ #
1311
+ return data
1312
+ else:
1313
+ #
1314
+ results = {}
1315
+ results["mineral"] = mineral
1316
+ results["state"] = var_state
1317
+ results["M"] = molar_mass
1318
+ element_list = np.array(amounts)[:, 0]
1319
+ results["chemistry"] = {}
1320
+ for index, element in enumerate(element_list, start=0):
1321
+ results["chemistry"][element] = amounts[index][2]
1322
+ results["rho"] = round(rho, 4)
1323
+ results["rho_e"] = round(rho_e, 4)
1324
+ results["V"] = round(V_m, 4)
1325
+ results["vP"] = round(vP, 4)
1326
+ results["vS"] = round(vS, 4)
1327
+ results["vP/vS"] = round(vPvS, 4)
1328
+ results["G"] = round(G*10**(-9), 4)
1329
+ results["K"] = round(K*10**(-9), 4)
1330
+ results["E"] = round(E*10**(-9), 4)
1331
+ results["nu"] = round(nu, 4)
1332
+ results["GR"] = round(gamma_ray, 4)
1333
+ results["PE"] = round(pe, 4)
1334
+ results["U"] = round(U, 4)
1335
+ if p != None:
1336
+ results["p"] = round(p, 4)
1337
+ else:
1338
+ results["p"] = p
1339
+ #
1340
+ return results
1341
+ #
1342
+ def create_siderite(self): # Fe(CO3)
1343
+ # Major elements
1344
+ carbon = PeriodicSystem(name="C").get_data()
1345
+ oxygen = PeriodicSystem(name="O").get_data()
1346
+ iron = PeriodicSystem(name="Fe").get_data()
1347
+ majors_name = ["C", "O", "Fe"]
1348
+ majors_data = np.array([["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]],
1349
+ ["Fe", iron[1], 1, iron[2]]], dtype=object)
1350
+ # Minor elements
1351
+ traces_data = []
1352
+ if len(self.traces_list) > 0:
1353
+ self.impurity = "impure"
1354
+ if self.impurity == "pure":
1355
+ var_state = "fixed"
1356
+ else:
1357
+ var_state = "variable"
1358
+ if self.impurity == "random":
1359
+ self.traces_list = []
1360
+ minors = ["Mn", "Mg", "Ca", "Zn", "Co"]
1361
+ n = rd.randint(1, len(minors))
1362
+ while len(self.traces_list) < n:
1363
+ selection = rd.choice(minors)
1364
+ if selection not in self.traces_list and selection not in majors_name:
1365
+ self.traces_list.append(selection)
1366
+ else:
1367
+ continue
1368
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1369
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1370
+ for i in range(len(self.traces_list)):
1371
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1372
+ if len(traces_data) > 0:
1373
+ traces_data = np.array(traces_data, dtype=object)
1374
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1375
+ #
1376
+ mineral = "Sd"
1377
+ #
1378
+ # Molar mass
1379
+ molar_mass_pure = iron[2] + (carbon[2] + 3*oxygen[2])
1380
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1381
+ majors=majors_data).calculate_molar_mass()
1382
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1383
+ # Density
1384
+ dataV = CrystalPhysics([[4.69, 15.38], [], "trigonal"])
1385
+ V = dataV.calculate_volume()
1386
+ Z = 6
1387
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1388
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1389
+ rho = dataRho.calculate_bulk_density()
1390
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1391
+ # Bulk modulus
1392
+ K = 124*10**9
1393
+ # Shear modulus
1394
+ G = 51*10**9
1395
+ # Young's modulus
1396
+ E = (9*K*G)/(3*K + G)
1397
+ # Poisson's ratio
1398
+ nu = (3*K - 2*G)/(2*(3*K + G))
1399
+ # vP/vS
1400
+ vPvS = ((K + 4/3*G)/G)**0.5
1401
+ # P-wave velocity
1402
+ vP = ((K + 4/3*G)/rho)**0.5
1403
+ # S-wave velocity
1404
+ vS = (G/rho)**0.5
1405
+ # Gamma ray
1406
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1407
+ # Photoelectricity
1408
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1409
+ U = pe*rho_e*10**(-3)
1410
+ # Electrical resistivity
1411
+ p = 70
1412
+ #
1413
+ if self.data_type == False:
1414
+ data = []
1415
+ data.append(mineral)
1416
+ data.append(round(molar_mass, 3))
1417
+ data.append(round(rho, 2))
1418
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1419
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1420
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1421
+ data.append(amounts)
1422
+ #
1423
+ return data
1424
+ else:
1425
+ #
1426
+ results = {}
1427
+ results["mineral"] = mineral
1428
+ results["state"] = var_state
1429
+ results["M"] = molar_mass
1430
+ element_list = np.array(amounts)[:, 0]
1431
+ results["chemistry"] = {}
1432
+ for index, element in enumerate(element_list, start=0):
1433
+ results["chemistry"][element] = amounts[index][2]
1434
+ results["rho"] = round(rho, 4)
1435
+ results["rho_e"] = round(rho_e, 4)
1436
+ results["V"] = round(V_m, 4)
1437
+ results["vP"] = round(vP, 4)
1438
+ results["vS"] = round(vS, 4)
1439
+ results["vP/vS"] = round(vPvS, 4)
1440
+ results["G"] = round(G*10**(-9), 4)
1441
+ results["K"] = round(K*10**(-9), 4)
1442
+ results["E"] = round(E*10**(-9), 4)
1443
+ results["nu"] = round(nu, 4)
1444
+ results["GR"] = round(gamma_ray, 4)
1445
+ results["PE"] = round(pe, 4)
1446
+ results["U"] = round(U, 4)
1447
+ if p != None:
1448
+ results["p"] = round(p, 4)
1449
+ else:
1450
+ results["p"] = p
1451
+ #
1452
+ return results
1453
+ #
1454
+ def create_organic_matter(self):
1455
+ # CHEMISTRY
1456
+ carbohydrates = Organics.carbohydrates("")
1457
+ lignin = Organics.lignin("")
1458
+ lipid = Organics.lipid("")
1459
+ # Major elements
1460
+ hydrogen = PeriodicSystem(name="H").get_data()
1461
+ carbon = PeriodicSystem(name="C").get_data()
1462
+ nitrogen = PeriodicSystem(name="N").get_data()
1463
+ oxygen = PeriodicSystem(name="O").get_data()
1464
+ sulfur = PeriodicSystem(name="S").get_data()
1465
+ majors_name = ["H", "C", "N", "O", "S"]
1466
+ # Minor elements
1467
+ traces_data = []
1468
+ if len(self.traces_list) > 0:
1469
+ self.impurity = "impure"
1470
+ if self.impurity == "pure":
1471
+ var_state = "variable"
1472
+ else:
1473
+ var_state = "variable"
1474
+ if self.impurity == "random":
1475
+ self.traces_list = []
1476
+ minors = [None]
1477
+ n = rd.randint(1, len(minors))
1478
+ while len(self.traces_list) < n:
1479
+ selection = rd.choice(minors)
1480
+ if selection not in self.traces_list and selection not in majors_name:
1481
+ self.traces_list.append(selection)
1482
+ else:
1483
+ continue
1484
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1485
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1486
+ for i in range(len(self.traces_list)):
1487
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1488
+ if len(traces_data) > 0:
1489
+ traces_data = np.array(traces_data, dtype=object)
1490
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1491
+ #
1492
+ mineral = "Org"
1493
+ #
1494
+ # Molar mass
1495
+ condition = False
1496
+ while condition == False:
1497
+ w_ch = round(rd.uniform(0.4, 0.6), 4)
1498
+ w_lg = round(rd.uniform(0.2, float(1-w_ch)), 4)
1499
+ w_lp = round(1 - w_ch - w_lg, 4)
1500
+ if w_ch+w_lg+w_lp == 1.0:
1501
+ condition = True
1502
+ molar_mass_pure = w_ch*(0.06*hydrogen[2] + 0.44*carbon[2] + 0.50*oxygen[2]) \
1503
+ + w_lg*(0.06*hydrogen[2] + 0.63*carbon[2] + 0.003*nitrogen[2] + 0.31*oxygen[2] + 0.001*sulfur[2]) \
1504
+ + w_lp*(0.10*hydrogen[2] + 0.80*carbon[2] + 0.10*oxygen[2])
1505
+ #
1506
+ majors_data = np.array([["H", hydrogen[1], w_ch*0.06*hydrogen[2] + w_lg*0.06*hydrogen[2] + w_lp*0.10*hydrogen[2], hydrogen[2]],
1507
+ ["C", carbon[1], w_ch*0.44*carbon[2] + w_lg*0.63*carbon[2] + w_lp*0.80*carbon[2], carbon[2]],
1508
+ ["N", nitrogen[1], w_lp*0.003*nitrogen[2], nitrogen[2]],
1509
+ ["O", oxygen[1], w_ch*0.50*oxygen[2] + w_lg*0.31*oxygen[2] + w_lp*0.10*oxygen[2], oxygen[2]],
1510
+ ["S", sulfur[1], w_lp*0.001*sulfur[2], sulfur[2]]], dtype=object)
1511
+ #
1512
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1513
+ majors=majors_data).calculate_molar_mass()
1514
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1515
+ # Density
1516
+ rho = w_ch*carbohydrates[2] + w_lg*lignin[2] + w_lp*lipid[2]
1517
+ # Bulk modulus
1518
+ K = (w_ch*carbohydrates[3][0] + w_lg*lignin[3][0] + w_lp*lipid[3][0])*10**9
1519
+ # Shear modulus
1520
+ G = (w_ch*carbohydrates[3][1] + w_lg*lignin[3][1] + w_lp*lipid[3][1])*10**9
1521
+ # Young's modulus
1522
+ E = (9*K*G)/(3*K + G)
1523
+ # Poisson's ratio
1524
+ nu = (3*K - 2*G)/(2*(3*K + G))
1525
+ # vP/vS
1526
+ vPvS = ((K + 4/3*G)/G)**0.5
1527
+ # P-wave velocity
1528
+ vP = ((K + 4/3*G)/rho)**0.5
1529
+ # S-wave velocity
1530
+ vS = (G/rho)**0.5
1531
+ # Gamma ray
1532
+ GR = 0
1533
+ # Photoelectricity
1534
+ PE = round(w_ch*carbohydrates[5][1] + w_lg*lignin[5][1] + w_lp*lipid[5][1], 3)
1535
+ # Electrical resistivity
1536
+ p = None
1537
+ #
1538
+ if self.data_type == False:
1539
+ data = []
1540
+ data.append(mineral)
1541
+ data.append(round(molar_mass, 3))
1542
+ data.append(round(rho, 2))
1543
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1544
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1545
+ data.append([round(GR, 2), round(PE, 2), p])
1546
+ data.append(amounts)
1547
+ #
1548
+ return data
1549
+ else:
1550
+ #
1551
+ results = {}
1552
+ results["mineral"] = mineral
1553
+ results["state"] = var_state
1554
+ results["M"] = round(molar_mass, 3)
1555
+ element_list = np.array(amounts)[:, 0]
1556
+ results["chemistry"] = {}
1557
+ for index, element in enumerate(element_list, start=0):
1558
+ results["chemistry"][element] = amounts[index][2]
1559
+ results["rho"] = round(rho, 4)
1560
+ results["vP"] = round(vP, 4)
1561
+ results["vS"] = round(vS, 4)
1562
+ results["vP/vS"] = round(vPvS, 4)
1563
+ results["G"] = round(G*10**(-9), 4)
1564
+ results["K"] = round(K*10**(-9), 4)
1565
+ results["E"] = round(E*10**(-9), 4)
1566
+ results["nu"] = round(nu, 4)
1567
+ results["GR"] = round(GR, 4)
1568
+ results["PE"] = round(PE, 4)
1569
+ if p != None:
1570
+ results["p"] = round(p, 4)
1571
+ else:
1572
+ results["p"] = p
1573
+ #
1574
+ return results
1575
+ #
1576
+ def create_rhodochrosite(self): # Mn(CO3)
1577
+ #
1578
+ name = "Rdc"
1579
+ #
1580
+ # Major elements
1581
+ carbon = PeriodicSystem(name="C").get_data()
1582
+ oxygen = PeriodicSystem(name="O").get_data()
1583
+ manganese = PeriodicSystem(name="Mn").get_data()
1584
+ majors_name = ["C", "O", "Mn"]
1585
+ majors_data = np.array([["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]],
1586
+ ["Mn", manganese[1], 1, manganese[2]]], dtype=object)
1587
+ # Minor elements
1588
+ traces_data = []
1589
+ if len(self.traces_list) > 0:
1590
+ self.impurity = "impure"
1591
+ if self.impurity == "pure":
1592
+ var_state = "fixed"
1593
+ else:
1594
+ var_state = "variable"
1595
+ if self.impurity == "random":
1596
+ self.traces_list = []
1597
+ minors = ["Fe", "Ca", "Mg", "Zn", "Co", "Cd"]
1598
+ n = rd.randint(1, len(minors))
1599
+ while len(self.traces_list) < n:
1600
+ selection = rd.choice(minors)
1601
+ if selection not in self.traces_list and selection not in majors_name:
1602
+ self.traces_list.append(selection)
1603
+ else:
1604
+ continue
1605
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1606
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1607
+ for i in range(len(self.traces_list)):
1608
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1609
+ if len(traces_data) > 0:
1610
+ traces_data = np.array(traces_data, dtype=object)
1611
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1612
+ #
1613
+ # Molar mass
1614
+ molar_mass_pure = manganese[2] + (carbon[2] + 3*oxygen[2])
1615
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1616
+ majors=majors_data).calculate_molar_mass()
1617
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1618
+ # Density
1619
+ dataV = CrystalPhysics([[4.777, 15.67], [], "trigonal"])
1620
+ V = dataV.calculate_volume()
1621
+ Z = 6
1622
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1623
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1624
+ rho = dataRho.calculate_bulk_density()
1625
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1626
+ # Bulk modulus
1627
+ K = 99*10**9
1628
+ # Shear modulus
1629
+ G = 44*10**9
1630
+ # Young's modulus
1631
+ E = (9*K*G)/(3*K + G)
1632
+ # Poisson's ratio
1633
+ nu = (3*K - 2*G)/(2*(3*K + G))
1634
+ # vP/vS
1635
+ vPvS = ((K + 4/3*G)/G)**0.5
1636
+ # P-wave velocity
1637
+ vP = ((K + 4/3*G)/rho)**0.5
1638
+ # S-wave velocity
1639
+ vS = (G/rho)**0.5
1640
+ # Gamma ray
1641
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1642
+ # Photoelectricity
1643
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1644
+ U = pe*rho_e*10**(-3)
1645
+ # Electrical resistivity
1646
+ p = None
1647
+ #
1648
+ if self.data_type == False:
1649
+ data = []
1650
+ data.append(name)
1651
+ data.append(round(molar_mass, 3))
1652
+ data.append(round(rho, 2))
1653
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1654
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1655
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1656
+ data.append(amounts)
1657
+ #
1658
+ return data
1659
+ else:
1660
+ #
1661
+ results = {}
1662
+ results["mineral"] = name
1663
+ results["state"] = var_state
1664
+ results["M"] = molar_mass
1665
+ element_list = np.array(amounts)[:, 0]
1666
+ results["chemistry"] = {}
1667
+ for index, element in enumerate(element_list, start=0):
1668
+ results["chemistry"][element] = amounts[index][2]
1669
+ results["rho"] = round(rho, 4)
1670
+ results["rho_e"] = round(rho_e, 4)
1671
+ results["V"] = round(V_m, 4)
1672
+ results["vP"] = round(vP, 4)
1673
+ results["vS"] = round(vS, 4)
1674
+ results["vP/vS"] = round(vPvS, 4)
1675
+ results["G"] = round(G*10**(-9), 4)
1676
+ results["K"] = round(K*10**(-9), 4)
1677
+ results["E"] = round(E*10**(-9), 4)
1678
+ results["nu"] = round(nu, 4)
1679
+ results["GR"] = round(gamma_ray, 4)
1680
+ results["PE"] = round(pe, 4)
1681
+ results["U"] = round(U, 4)
1682
+ if p != None:
1683
+ results["p"] = round(p, 4)
1684
+ else:
1685
+ results["p"] = p
1686
+ #
1687
+ return results
1688
+ #
1689
+ def create_aragonite(self): # Ca(CO3)
1690
+ #
1691
+ name = "Arg"
1692
+ #
1693
+ # Major elements
1694
+ carbon = PeriodicSystem(name="C").get_data()
1695
+ oxygen = PeriodicSystem(name="O").get_data()
1696
+ calcium = PeriodicSystem(name="Ca").get_data()
1697
+ majors_name = ["C", "O", "Ca"]
1698
+ majors_data = np.array([["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]],
1699
+ ["Ca", calcium[1], 1, calcium[2]]], dtype=object)
1700
+ # Minor elements
1701
+ traces_data = []
1702
+ if len(self.traces_list) > 0:
1703
+ self.impurity = "impure"
1704
+ if self.impurity == "pure":
1705
+ var_state = "fixed"
1706
+ else:
1707
+ var_state = "variable"
1708
+ if self.impurity == "random":
1709
+ self.traces_list = []
1710
+ minors = ["Sr", "Pb", "Zn"]
1711
+ n = rd.randint(1, len(minors))
1712
+ while len(self.traces_list) < n:
1713
+ selection = rd.choice(minors)
1714
+ if selection not in self.traces_list and selection not in majors_name:
1715
+ self.traces_list.append(selection)
1716
+ else:
1717
+ continue
1718
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1719
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1720
+ for i in range(len(self.traces_list)):
1721
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1722
+ if len(traces_data) > 0:
1723
+ traces_data = np.array(traces_data, dtype=object)
1724
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1725
+ #
1726
+ # Molar mass
1727
+ molar_mass_pure = calcium[2] + (carbon[2] + 3*oxygen[2])
1728
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1729
+ majors=majors_data).calculate_molar_mass()
1730
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1731
+ # Density
1732
+ dataV = CrystalPhysics([[4.959, 7.968, 5.741], [], "orthorhombic"])
1733
+ V = dataV.calculate_volume()
1734
+ Z = 4
1735
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1736
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1737
+ rho = dataRho.calculate_bulk_density()
1738
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1739
+ # Bulk modulus
1740
+ K = 69*10**9
1741
+ # Shear modulus
1742
+ G = 33*10**9
1743
+ # Young's modulus
1744
+ E = (9*K*G)/(3*K + G)
1745
+ # Poisson's ratio
1746
+ nu = (3*K - 2*G)/(2*(3*K + G))
1747
+ # vP/vS
1748
+ vPvS = ((K + 4/3*G)/G)**0.5
1749
+ # P-wave velocity
1750
+ vP = ((K + 4/3*G)/rho)**0.5
1751
+ # S-wave velocity
1752
+ vS = (G/rho)**0.5
1753
+ # Gamma ray
1754
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1755
+ # Photoelectricity
1756
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1757
+ U = pe*rho_e*10**(-3)
1758
+ # Electrical resistivity
1759
+ p = None
1760
+ #
1761
+ if self.data_type == False:
1762
+ data = []
1763
+ data.append(name)
1764
+ data.append(round(molar_mass, 3))
1765
+ data.append(round(rho, 2))
1766
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1767
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1768
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1769
+ data.append(amounts)
1770
+ #
1771
+ return data
1772
+ else:
1773
+ #
1774
+ results = {}
1775
+ results["mineral"] = name
1776
+ results["state"] = var_state
1777
+ results["M"] = molar_mass
1778
+ element_list = np.array(amounts)[:, 0]
1779
+ results["chemistry"] = {}
1780
+ for index, element in enumerate(element_list, start=0):
1781
+ results["chemistry"][element] = amounts[index][2]
1782
+ results["rho"] = round(rho, 4)
1783
+ results["rho_e"] = round(rho_e, 4)
1784
+ results["V"] = round(V_m, 4)
1785
+ results["vP"] = round(vP, 4)
1786
+ results["vS"] = round(vS, 4)
1787
+ results["vP/vS"] = round(vPvS, 4)
1788
+ results["G"] = round(G*10**(-9), 4)
1789
+ results["K"] = round(K*10**(-9), 4)
1790
+ results["E"] = round(E*10**(-9), 4)
1791
+ results["nu"] = round(nu, 4)
1792
+ results["GR"] = round(gamma_ray, 4)
1793
+ results["PE"] = round(pe, 4)
1794
+ results["U"] = round(U, 4)
1795
+ if p != None:
1796
+ results["p"] = round(p, 4)
1797
+ else:
1798
+ results["p"] = p
1799
+ #
1800
+ return results
1801
+ #
1802
+ def create_cerussite(self): # Pb(CO3)
1803
+ #
1804
+ name = "Cer"
1805
+ #
1806
+ # Major elements
1807
+ carbon = PeriodicSystem(name="C").get_data()
1808
+ oxygen = PeriodicSystem(name="O").get_data()
1809
+ lead = PeriodicSystem(name="Pb").get_data()
1810
+ majors_name = ["C", "O", "Pb"]
1811
+ majors_data = np.array([["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]],
1812
+ ["Pb", lead[1], 1, lead[2]]], dtype=object)
1813
+ # Minor elements
1814
+ traces_data = []
1815
+ if len(self.traces_list) > 0:
1816
+ self.impurity = "impure"
1817
+ if self.impurity == "pure":
1818
+ var_state = "fixed"
1819
+ else:
1820
+ var_state = "variable"
1821
+ if self.impurity == "random":
1822
+ self.traces_list = []
1823
+ minors = [None]
1824
+ n = rd.randint(1, len(minors))
1825
+ while len(self.traces_list) < n:
1826
+ selection = rd.choice(minors)
1827
+ if selection not in self.traces_list and selection not in majors_name:
1828
+ self.traces_list.append(selection)
1829
+ else:
1830
+ continue
1831
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1832
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1833
+ for i in range(len(self.traces_list)):
1834
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1835
+ if len(traces_data) > 0:
1836
+ traces_data = np.array(traces_data, dtype=object)
1837
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1838
+ #
1839
+ # Molar mass
1840
+ molar_mass_pure = lead[2] + (carbon[2] + 3*oxygen[2])
1841
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1842
+ majors=majors_data).calculate_molar_mass()
1843
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1844
+ # Density
1845
+ dataV = CrystalPhysics([[5.195, 8.436, 6.152], [], "orthorhombic"])
1846
+ V = dataV.calculate_volume()
1847
+ Z = 4
1848
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
1849
+ dataRho = CrystalPhysics([molar_mass, Z, V])
1850
+ rho = dataRho.calculate_bulk_density()
1851
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
1852
+ # Bulk modulus
1853
+ K = 56*10**9
1854
+ # Shear modulus
1855
+ G = 21*10**9
1856
+ # Young's modulus
1857
+ E = (9*K*G)/(3*K + G)
1858
+ # Poisson's ratio
1859
+ nu = (3*K - 2*G)/(2*(3*K + G))
1860
+ # vP/vS
1861
+ vPvS = ((K + 4/3*G)/G)**0.5
1862
+ # P-wave velocity
1863
+ vP = ((K + 4/3*G)/rho)**0.5
1864
+ # S-wave velocity
1865
+ vS = (G/rho)**0.5
1866
+ # Gamma ray
1867
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
1868
+ # Photoelectricity
1869
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
1870
+ U = pe*rho_e*10**(-3)
1871
+ # Electrical resistivity
1872
+ p = None
1873
+ #
1874
+ if self.data_type == False:
1875
+ data = []
1876
+ data.append(name)
1877
+ data.append(round(molar_mass, 3))
1878
+ data.append(round(rho, 2))
1879
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
1880
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
1881
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
1882
+ data.append(amounts)
1883
+ #
1884
+ return data
1885
+ else:
1886
+ #
1887
+ results = {}
1888
+ results["mineral"] = name
1889
+ results["state"] = var_state
1890
+ results["M"] = molar_mass
1891
+ element_list = np.array(amounts)[:, 0]
1892
+ results["chemistry"] = {}
1893
+ for index, element in enumerate(element_list, start=0):
1894
+ results["chemistry"][element] = amounts[index][2]
1895
+ results["rho"] = round(rho, 4)
1896
+ results["rho_e"] = round(rho_e, 4)
1897
+ results["V"] = round(V_m, 4)
1898
+ results["vP"] = round(vP, 4)
1899
+ results["vS"] = round(vS, 4)
1900
+ results["vP/vS"] = round(vPvS, 4)
1901
+ results["G"] = round(G*10**(-9), 4)
1902
+ results["K"] = round(K*10**(-9), 4)
1903
+ results["E"] = round(E*10**(-9), 4)
1904
+ results["nu"] = round(nu, 4)
1905
+ results["GR"] = round(gamma_ray, 4)
1906
+ results["PE"] = round(pe, 4)
1907
+ results["U"] = round(U, 4)
1908
+ if p != None:
1909
+ results["p"] = round(p, 4)
1910
+ else:
1911
+ results["p"] = p
1912
+ #
1913
+ return results
1914
+ #
1915
+ def create_ankerite(self): # Ca(Fe,Mg)(CO3)2
1916
+ #
1917
+ name = "Ank"
1918
+ #
1919
+ # Major elements
1920
+ carbon = PeriodicSystem(name="C").get_data()
1921
+ oxygen = PeriodicSystem(name="O").get_data()
1922
+ magnesium = PeriodicSystem(name="Mg").get_data()
1923
+ iron = PeriodicSystem(name="Fe").get_data()
1924
+ calcium = PeriodicSystem(name="Ca").get_data()
1925
+ majors_name = ["C", "O", "Mg", "Fe"]
1926
+ #
1927
+ x = round(rd.uniform(0, 1.0), 4)
1928
+ #
1929
+ majors_data = np.array([["C", carbon[1], 2, carbon[2]], ["O", oxygen[1], 6, oxygen[2]],
1930
+ ["Mg", magnesium[1], (1-x), magnesium[2]], ["Ca", calcium[1], 1, calcium[2]],
1931
+ ["Fe", iron[1], x, iron[2]]], dtype=object)
1932
+ # Minor elements
1933
+ traces_data = []
1934
+ if len(self.traces_list) > 0:
1935
+ self.impurity = "impure"
1936
+ if self.impurity == "pure":
1937
+ var_state = "variable"
1938
+ else:
1939
+ var_state = "variable"
1940
+ if self.impurity == "random":
1941
+ self.traces_list = []
1942
+ minors = ["Mn"]
1943
+ n = rd.randint(1, len(minors))
1944
+ while len(self.traces_list) < n:
1945
+ selection = rd.choice(minors)
1946
+ if selection not in self.traces_list and selection not in majors_name:
1947
+ self.traces_list.append(selection)
1948
+ else:
1949
+ continue
1950
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
1951
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
1952
+ for i in range(len(self.traces_list)):
1953
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
1954
+ if len(traces_data) > 0:
1955
+ traces_data = np.array(traces_data, dtype=object)
1956
+ traces_data = traces_data[traces_data[:, 1].argsort()]
1957
+ #
1958
+ # Molar mass
1959
+ molar_mass_pure = calcium[2] + (x*iron[2] + (1-x)*magnesium[2]) + 2*(carbon[2] + 3*oxygen[2])
1960
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
1961
+ majors=majors_data).calculate_molar_mass()
1962
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
1963
+ # Density
1964
+ dataV_Fe = CrystalPhysics([[4.83, 16.167], [], "trigonal"])
1965
+ V_Fe = dataV_Fe.calculate_volume()
1966
+ Z_Fe = 3
1967
+ V_m_Fe = MineralChemistry().calculate_molar_volume(volume_cell=V_Fe, z=Z_Fe)
1968
+ dataRho_Fe = CrystalPhysics([molar_mass, Z_Fe, V_Fe])
1969
+ rho_Fe = dataRho_Fe.calculate_bulk_density()
1970
+ rho_e_Fe = wg(amounts=amounts, elements=element, rho_b=rho_Fe).calculate_electron_density()
1971
+ dataV_Mg = CrystalPhysics([[4.83, 16.167], [], "trigonal"])
1972
+ V_Mg = dataV_Mg.calculate_volume()
1973
+ Z_Mg = 3
1974
+ V_m_Mg = MineralChemistry().calculate_molar_volume(volume_cell=V_Mg, z=Z_Mg)
1975
+ dataRho_Mg = CrystalPhysics([molar_mass, Z_Mg, V_Mg])
1976
+ rho_Mg = dataRho_Fe.calculate_bulk_density()
1977
+ rho_e_Mg = wg(amounts=amounts, elements=element, rho_b=rho_Mg).calculate_electron_density()
1978
+ V = x*V_Fe + (1-x)*V_Mg
1979
+ V_m = x*V_m_Fe + (1-x)*V_m_Mg
1980
+ rho = x*rho_Fe + (1-x)*rho_Mg
1981
+ rho_e = x*rho_e_Fe + (1-x)*rho_e_Mg
1982
+ # Bulk modulus
1983
+ K_Fe = 73*10**9
1984
+ K_Mg = 89*10**9
1985
+ K = x*K_Fe + (1-x)*K_Mg
1986
+ # Shear modulus
1987
+ G_Fe = 32*10**9
1988
+ G_Mg = 44*10**9
1989
+ G = x*G_Fe + (1-x)*G_Mg
1990
+ # Young's modulus
1991
+ E = (9*K*G)/(3*K + G)
1992
+ # Poisson's ratio
1993
+ nu = (3*K - 2*G)/(2*(3*K + G))
1994
+ # vP/vS
1995
+ vPvS = ((K + 4/3*G)/G)**0.5
1996
+ # P-wave velocity
1997
+ vP = ((K + 4/3*G)/rho)**0.5
1998
+ # S-wave velocity
1999
+ vS = (G/rho)**0.5
2000
+ # Gamma ray
2001
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
2002
+ # Photoelectricity
2003
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
2004
+ U = pe*rho_e*10**(-3)
2005
+ # Electrical resistivity
2006
+ p = None
2007
+ #
2008
+ if self.data_type == False:
2009
+ data = []
2010
+ data.append(name)
2011
+ data.append(round(molar_mass, 3))
2012
+ data.append(round(rho, 2))
2013
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
2014
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
2015
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
2016
+ data.append(amounts)
2017
+ #
2018
+ return data
2019
+ else:
2020
+ #
2021
+ results = {}
2022
+ results["mineral"] = name
2023
+ results["state"] = var_state
2024
+ results["M"] = molar_mass
2025
+ element_list = np.array(amounts)[:, 0]
2026
+ results["chemistry"] = {}
2027
+ for index, element in enumerate(element_list, start=0):
2028
+ results["chemistry"][element] = amounts[index][2]
2029
+ results["rho"] = round(rho, 4)
2030
+ results["rho_e"] = round(rho_e, 4)
2031
+ results["V"] = round(V_m, 4)
2032
+ results["vP"] = round(vP, 4)
2033
+ results["vS"] = round(vS, 4)
2034
+ results["vP/vS"] = round(vPvS, 4)
2035
+ results["G"] = round(G*10**(-9), 4)
2036
+ results["K"] = round(K*10**(-9), 4)
2037
+ results["E"] = round(E*10**(-9), 4)
2038
+ results["nu"] = round(nu, 4)
2039
+ results["GR"] = round(gamma_ray, 4)
2040
+ results["PE"] = round(pe, 4)
2041
+ results["U"] = round(U, 4)
2042
+ if p != None:
2043
+ results["p"] = round(p, 4)
2044
+ else:
2045
+ results["p"] = p
2046
+ #
2047
+ return results
2048
+ #
2049
+ def create_azurite(self): # Cu3(CO3)2(OH)2
2050
+ #
2051
+ name = "Az"
2052
+ #
2053
+ # Major elements
2054
+ hydrogen = PeriodicSystem(name="H").get_data()
2055
+ carbon = PeriodicSystem(name="C").get_data()
2056
+ oxygen = PeriodicSystem(name="O").get_data()
2057
+ copper = PeriodicSystem(name="Cu").get_data()
2058
+ majors_name = ["H", "C", "O", "Cu"]
2059
+ #
2060
+ majors_data = np.array([["H", hydrogen[1], 2, hydrogen[2]], ["C", carbon[1], 2, carbon[2]],
2061
+ ["O", oxygen[1], 8, oxygen[2]], ["Cu", copper[1], 3, copper[2]]], dtype=object)
2062
+ # Minor elements
2063
+ traces_data = []
2064
+ if len(self.traces_list) > 0:
2065
+ self.impurity = "impure"
2066
+ if self.impurity == "pure":
2067
+ var_state = "fixed"
2068
+ else:
2069
+ var_state = "variable"
2070
+ if self.impurity == "random":
2071
+ self.traces_list = []
2072
+ minors = [None]
2073
+ n = rd.randint(1, len(minors))
2074
+ while len(self.traces_list) < n:
2075
+ selection = rd.choice(minors)
2076
+ if selection not in self.traces_list and selection not in majors_name:
2077
+ self.traces_list.append(selection)
2078
+ else:
2079
+ continue
2080
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
2081
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
2082
+ for i in range(len(self.traces_list)):
2083
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
2084
+ if len(traces_data) > 0:
2085
+ traces_data = np.array(traces_data, dtype=object)
2086
+ traces_data = traces_data[traces_data[:, 1].argsort()]
2087
+ #
2088
+ # Molar mass
2089
+ molar_mass_pure = 3*copper[2] + 2*(carbon[2] + 3*oxygen[2]) + 2*(oxygen[2] + hydrogen[2])
2090
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
2091
+ majors=majors_data).calculate_molar_mass()
2092
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
2093
+ # Density
2094
+ dataV = CrystalPhysics([[5.008, 5.844, 10.336], [92.333], "monoclinic"])
2095
+ V = dataV.calculate_volume()
2096
+ Z = 2
2097
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
2098
+ dataRho = CrystalPhysics([molar_mass, Z, V])
2099
+ rho = dataRho.calculate_bulk_density()
2100
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
2101
+ # Bulk modulus
2102
+ K = 112.35*10**9
2103
+ # Shear modulus
2104
+ G = 49.33*10**9
2105
+ # Young's modulus
2106
+ E = (9*K*G)/(3*K + G)
2107
+ # Poisson's ratio
2108
+ nu = (3*K - 2*G)/(2*(3*K + G))
2109
+ # vP/vS
2110
+ vPvS = ((K + 4/3*G)/G)**0.5
2111
+ # P-wave velocity
2112
+ vP = ((K + 4/3*G)/rho)**0.5
2113
+ # S-wave velocity
2114
+ vS = (G/rho)**0.5
2115
+ # Gamma ray
2116
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
2117
+ # Photoelectricity
2118
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
2119
+ U = pe*rho_e*10**(-3)
2120
+ # Electrical resistivity
2121
+ p = None
2122
+ #
2123
+ if self.data_type == False:
2124
+ data = []
2125
+ data.append(name)
2126
+ data.append(round(molar_mass, 3))
2127
+ data.append(round(rho, 2))
2128
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
2129
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
2130
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
2131
+ data.append(amounts)
2132
+ #
2133
+ return data
2134
+ else:
2135
+ #
2136
+ results = {}
2137
+ results["mineral"] = name
2138
+ results["state"] = var_state
2139
+ results["M"] = molar_mass
2140
+ element_list = np.array(amounts)[:, 0]
2141
+ results["chemistry"] = {}
2142
+ for index, element in enumerate(element_list, start=0):
2143
+ results["chemistry"][element] = amounts[index][2]
2144
+ results["rho"] = round(rho, 4)
2145
+ results["rho_e"] = round(rho_e, 4)
2146
+ results["V"] = round(V_m, 4)
2147
+ results["vP"] = round(vP, 4)
2148
+ results["vS"] = round(vS, 4)
2149
+ results["vP/vS"] = round(vPvS, 4)
2150
+ results["G"] = round(G*10**(-9), 4)
2151
+ results["K"] = round(K*10**(-9), 4)
2152
+ results["E"] = round(E*10**(-9), 4)
2153
+ results["nu"] = round(nu, 4)
2154
+ results["GR"] = round(gamma_ray, 4)
2155
+ results["PE"] = round(pe, 4)
2156
+ results["U"] = round(U, 4)
2157
+ if p != None:
2158
+ results["p"] = round(p, 4)
2159
+ else:
2160
+ results["p"] = p
2161
+ #
2162
+ return results
2163
+ #
2164
+ def create_malachite(self): # Cu2(CO3)(OH)2
2165
+ #
2166
+ name = "Mal"
2167
+ #
2168
+ # Major elements
2169
+ hydrogen = PeriodicSystem(name="H").get_data()
2170
+ carbon = PeriodicSystem(name="C").get_data()
2171
+ oxygen = PeriodicSystem(name="O").get_data()
2172
+ copper = PeriodicSystem(name="Cu").get_data()
2173
+ majors_name = ["H", "C", "O", "Cu"]
2174
+ #
2175
+ majors_data = np.array([["H", hydrogen[1], 2, hydrogen[2]], ["C", carbon[1], 2, carbon[2]],
2176
+ ["O", oxygen[1], 8, oxygen[2]], ["Cu", copper[1], 3, copper[2]]], dtype=object)
2177
+ # Minor elements
2178
+ traces_data = []
2179
+ if len(self.traces_list) > 0:
2180
+ self.impurity = "impure"
2181
+ if self.impurity == "pure":
2182
+ var_state = "fixed"
2183
+ else:
2184
+ var_state = "variable"
2185
+ if self.impurity == "random":
2186
+ self.traces_list = []
2187
+ minors = ["Zn", "Co", "Ni"]
2188
+ n = rd.randint(1, len(minors))
2189
+ while len(self.traces_list) < n:
2190
+ selection = rd.choice(minors)
2191
+ if selection not in self.traces_list and selection not in majors_name:
2192
+ self.traces_list.append(selection)
2193
+ else:
2194
+ continue
2195
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
2196
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
2197
+ for i in range(len(self.traces_list)):
2198
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
2199
+ if len(traces_data) > 0:
2200
+ traces_data = np.array(traces_data, dtype=object)
2201
+ traces_data = traces_data[traces_data[:, 1].argsort()]
2202
+ #
2203
+ # Molar mass
2204
+ molar_mass_pure = 2*copper[2] + (carbon[2] + 3*oxygen[2]) + 2*(oxygen[2] + hydrogen[2])
2205
+ molar_mass, amounts = MineralChemistry(w_traces=traces_data, molar_mass_pure=molar_mass_pure,
2206
+ majors=majors_data).calculate_molar_mass()
2207
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
2208
+ # Density
2209
+ dataV = CrystalPhysics([[9.502, 11.974, 3.24], [98.75], "monoclinic"])
2210
+ V = dataV.calculate_volume()
2211
+ Z = 4
2212
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
2213
+ dataRho = CrystalPhysics([molar_mass, Z, V])
2214
+ rho = dataRho.calculate_bulk_density()
2215
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
2216
+ # Bulk modulus
2217
+ K = 118.77*10**9
2218
+ # Shear modulus
2219
+ G = 50.06*10**9
2220
+ # Young's modulus
2221
+ E = (9*K*G)/(3*K + G)
2222
+ # Poisson's ratio
2223
+ nu = (3*K - 2*G)/(2*(3*K + G))
2224
+ # vP/vS
2225
+ vPvS = ((K + 4/3*G)/G)**0.5
2226
+ # P-wave velocity
2227
+ vP = ((K + 4/3*G)/rho)**0.5
2228
+ # S-wave velocity
2229
+ vS = (G/rho)**0.5
2230
+ # Gamma ray
2231
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
2232
+ # Photoelectricity
2233
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
2234
+ U = pe*rho_e*10**(-3)
2235
+ # Electrical resistivity
2236
+ p = None
2237
+ #
2238
+ if self.data_type == False:
2239
+ data = []
2240
+ data.append(name)
2241
+ data.append(round(molar_mass, 3))
2242
+ data.append(round(rho, 2))
2243
+ data.append([round(K*10**(-9), 2), round(G*10**(-9), 2), round(E*10**(-9), 2), round(nu, 4)])
2244
+ data.append([round(vP, 2), round(vS, 2), round(vPvS, 2)])
2245
+ data.append([round(gamma_ray, 2), round(pe, 2), round(U, 2), p])
2246
+ data.append(amounts)
2247
+ #
2248
+ return data
2249
+ else:
2250
+ #
2251
+ results = {}
2252
+ results["mineral"] = name
2253
+ results["state"] = var_state
2254
+ results["M"] = molar_mass
2255
+ element_list = np.array(amounts)[:, 0]
2256
+ results["chemistry"] = {}
2257
+ for index, element in enumerate(element_list, start=0):
2258
+ results["chemistry"][element] = amounts[index][2]
2259
+ results["rho"] = round(rho, 4)
2260
+ results["rho_e"] = round(rho_e, 4)
2261
+ results["V"] = round(V_m, 4)
2262
+ results["vP"] = round(vP, 4)
2263
+ results["vS"] = round(vS, 4)
2264
+ results["vP/vS"] = round(vPvS, 4)
2265
+ results["G"] = round(G*10**(-9), 4)
2266
+ results["K"] = round(K*10**(-9), 4)
2267
+ results["E"] = round(E*10**(-9), 4)
2268
+ results["nu"] = round(nu, 4)
2269
+ results["GR"] = round(gamma_ray, 4)
2270
+ results["PE"] = round(pe, 4)
2271
+ results["U"] = round(U, 4)
2272
+ if p != None:
2273
+ results["p"] = round(p, 4)
2274
+ else:
2275
+ results["p"] = p
2276
+ #
2277
+ return results
2278
+ #
2279
+ def create_ikaite(self): # CaCO3 * 6*H2O
2280
+ #
2281
+ name = "Ika"
2282
+ #
2283
+ # Major elements
2284
+ hydrogen = PeriodicSystem(name="H").get_data()
2285
+ carbon = PeriodicSystem(name="C").get_data()
2286
+ oxygen = PeriodicSystem(name="O").get_data()
2287
+ calcium = PeriodicSystem(name="Ca").get_data()
2288
+ majors_name = ["H", "C", "O", "Ca"]
2289
+ #
2290
+ majors_data = np.array([["H", hydrogen[1], 2, hydrogen[2]], ["C", carbon[1], 2, carbon[2]],
2291
+ ["O", oxygen[1], 8, oxygen[2]], ["Ca", calcium[1], 3, calcium[2]]], dtype=object)
2292
+ # Minor elements
2293
+ traces_data = []
2294
+ if len(self.traces_list) > 0:
2295
+ self.impurity = "impure"
2296
+ if self.impurity == "pure":
2297
+ var_state = "fixed"
2298
+ else:
2299
+ var_state = "variable"
2300
+ if self.impurity == "random":
2301
+ self.traces_list = []
2302
+ minors = [None]
2303
+ n = rd.randint(1, len(minors))
2304
+ while len(self.traces_list) < n:
2305
+ selection = rd.choice(minors)
2306
+ if selection not in self.traces_list and selection not in majors_name:
2307
+ self.traces_list.append(selection)
2308
+ else:
2309
+ continue
2310
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
2311
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
2312
+ for i in range(len(self.traces_list)):
2313
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
2314
+ if len(traces_data) > 0:
2315
+ traces_data = np.array(traces_data, dtype=object)
2316
+ traces_data = traces_data[traces_data[:, 1].argsort()]
2317
+ #
2318
+ # Molar mass
2319
+ molar_mass_pure = calcium[2] + (carbon[2] + 3*oxygen[2]) + 6*(2*hydrogen[2] + oxygen[2])
2320
+ molar_mass, amounts = MineralChemistry(
2321
+ w_traces=traces_data, molar_mass_pure=molar_mass_pure, majors=majors_data).calculate_molar_mass()
2322
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
2323
+ # Density
2324
+ dataV = CrystalPhysics([[8.87, 8.23, 11.02], [110.2], "monoclinic"])
2325
+ V = dataV.calculate_volume()
2326
+ Z = 4
2327
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
2328
+ dataRho = CrystalPhysics([molar_mass, Z, V])
2329
+ rho = dataRho.calculate_bulk_density()
2330
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
2331
+ # Bulk modulus
2332
+ K = np.mean([30.9524, 40.3962])*10**9
2333
+ # Shear modulus
2334
+ G = np.mean([16.4415, 18.714])*10**9
2335
+ # Young's modulus
2336
+ E = (9*K*G)/(3*K + G)
2337
+ # Poisson's ratio
2338
+ nu = (3*K - 2*G)/(2*(3*K + G))
2339
+ # vP/vS
2340
+ vPvS = ((K + 4/3*G)/G)**0.5
2341
+ # P-wave velocity
2342
+ vP = ((K + 4/3*G)/rho)**0.5
2343
+ # S-wave velocity
2344
+ vS = (G/rho)**0.5
2345
+ # Gamma ray
2346
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
2347
+ # Photoelectricity
2348
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
2349
+ U = pe*rho_e*10**(-3)
2350
+ # Electrical resistivity
2351
+ p = None
2352
+ #
2353
+ results = {}
2354
+ results["mineral"] = name
2355
+ results["state"] = var_state
2356
+ results["M"] = molar_mass
2357
+ element_list = np.array(amounts)[:, 0]
2358
+ results["chemistry"] = {}
2359
+ for index, element in enumerate(element_list, start=0):
2360
+ results["chemistry"][element] = amounts[index][2]
2361
+ results["rho"] = round(rho, 4)
2362
+ results["rho_e"] = round(rho_e, 4)
2363
+ results["V"] = round(V_m, 4)
2364
+ results["vP"] = round(vP, 4)
2365
+ results["vS"] = round(vS, 4)
2366
+ results["vP/vS"] = round(vPvS, 4)
2367
+ results["G"] = round(G*10**(-9), 4)
2368
+ results["K"] = round(K*10**(-9), 4)
2369
+ results["E"] = round(E*10**(-9), 4)
2370
+ results["nu"] = round(nu, 4)
2371
+ results["GR"] = round(gamma_ray, 4)
2372
+ results["PE"] = round(pe, 4)
2373
+ results["U"] = round(U, 4)
2374
+ if p != None:
2375
+ results["p"] = round(p, 4)
2376
+ else:
2377
+ results["p"] = p
2378
+ #
2379
+ return results
2380
+ #
2381
+ def create_smithsonite(self): # ZnCO3
2382
+ #
2383
+ name = "Smt"
2384
+ #
2385
+ # Major elements
2386
+ carbon = PeriodicSystem(name="C").get_data()
2387
+ oxygen = PeriodicSystem(name="O").get_data()
2388
+ zinc = PeriodicSystem(name="Zn").get_data()
2389
+ majors_name = ["C", "O", "Zn"]
2390
+ #
2391
+ majors_data = np.array(
2392
+ [["C", carbon[1], 1, carbon[2]], ["O", oxygen[1], 3, oxygen[2]], ["Zn", zinc[1], 1, zinc[2]]], dtype=object)
2393
+ # Minor elements
2394
+ traces_data = []
2395
+ if len(self.traces_list) > 0:
2396
+ self.impurity = "impure"
2397
+ if self.impurity == "pure":
2398
+ var_state = "fixed"
2399
+ else:
2400
+ var_state = "variable"
2401
+ if self.impurity == "random":
2402
+ self.traces_list = []
2403
+ minors = ["Fe", "Co", "Cu", "Mn", "Ca", "Cd", "Mg", "In"]
2404
+ n = rd.randint(1, len(minors))
2405
+ while len(self.traces_list) < n:
2406
+ selection = rd.choice(minors)
2407
+ if selection not in self.traces_list and selection not in majors_name:
2408
+ self.traces_list.append(selection)
2409
+ else:
2410
+ continue
2411
+ traces = [PeriodicSystem(name=i).get_data() for i in self.traces_list]
2412
+ x_traces = [round(rd.uniform(0., 0.001), 6) for i in range(len(self.traces_list))]
2413
+ for i in range(len(self.traces_list)):
2414
+ traces_data.append([str(self.traces_list[i]), int(traces[i][1]), float(x_traces[i])])
2415
+ if len(traces_data) > 0:
2416
+ traces_data = np.array(traces_data, dtype=object)
2417
+ traces_data = traces_data[traces_data[:, 1].argsort()]
2418
+ #
2419
+ # Molar mass
2420
+ molar_mass_pure = zinc[2] + (carbon[2] + 3*oxygen[2])
2421
+ molar_mass, amounts = MineralChemistry(
2422
+ w_traces=traces_data, molar_mass_pure=molar_mass_pure, majors=majors_data).calculate_molar_mass()
2423
+ element = [PeriodicSystem(name=amounts[i][0]).get_data() for i in range(len(amounts))]
2424
+ # Density
2425
+ dataV = CrystalPhysics([[4.653, 15.028], [], "trigonal"])
2426
+ V = dataV.calculate_volume()
2427
+ Z = 6
2428
+ V_m = MineralChemistry().calculate_molar_volume(volume_cell=V, z=Z)
2429
+ dataRho = CrystalPhysics([molar_mass, Z, V])
2430
+ rho = dataRho.calculate_bulk_density()
2431
+ rho_e = wg(amounts=amounts, elements=element, rho_b=rho).calculate_electron_density()
2432
+ # Bulk modulus
2433
+ K = 117*10**9
2434
+ # Shear modulus
2435
+ G = 49*10**9
2436
+ # Young's modulus
2437
+ E = (9 * K * G) / (3 * K + G)
2438
+ # Poisson's ratio
2439
+ nu = (3 * K - 2 * G) / (2 * (3 * K + G))
2440
+ # vP/vS
2441
+ vPvS = ((K + 4 / 3 * G) / G) ** 0.5
2442
+ # P-wave velocity
2443
+ vP = ((K + 4 / 3 * G) / rho) ** 0.5
2444
+ # S-wave velocity
2445
+ vS = (G / rho) ** 0.5
2446
+ # Gamma ray
2447
+ gamma_ray = wg(amounts=amounts, elements=element).calculate_gr()
2448
+ # Photoelectricity
2449
+ pe = wg(amounts=amounts, elements=element).calculate_pe()
2450
+ U = pe * rho_e * 10 ** (-3)
2451
+ # Electrical resistivity
2452
+ p = None
2453
+ #
2454
+ results = {}
2455
+ results["mineral"] = name
2456
+ results["state"] = var_state
2457
+ results["M"] = molar_mass
2458
+ element_list = np.array(amounts)[:, 0]
2459
+ results["chemistry"] = {}
2460
+ for index, element in enumerate(element_list, start=0):
2461
+ results["chemistry"][element] = amounts[index][2]
2462
+ results["rho"] = round(rho, 4)
2463
+ results["rho_e"] = round(rho_e, 4)
2464
+ results["V"] = round(V_m, 4)
2465
+ results["vP"] = round(vP, 4)
2466
+ results["vS"] = round(vS, 4)
2467
+ results["vP/vS"] = round(vPvS, 4)
2468
+ results["G"] = round(G * 10 ** (-9), 4)
2469
+ results["K"] = round(K * 10 ** (-9), 4)
2470
+ results["E"] = round(E * 10 ** (-9), 4)
2471
+ results["nu"] = round(nu, 4)
2472
+ results["GR"] = round(gamma_ray, 4)
2473
+ results["PE"] = round(pe, 4)
2474
+ results["U"] = round(U, 4)
2475
+ if p != None:
2476
+ results["p"] = round(p, 4)
2477
+ else:
2478
+ results["p"] = p
2479
+ #
2480
+ return results
2481
+ #
2482
+ class CustomCarbonates:
2483
+ #
2484
+ def __init__(self, fluid, actualThickness, output_type=False, porosity=None):
2485
+ self.fluid = fluid
2486
+ self.actualThickness = actualThickness
2487
+ self.output_type = output_type
2488
+ self.porosity = porosity
2489
+ #
2490
+ def create_custom_rock_01(self, amounts=None):
2491
+ #
2492
+ self.amounts = amounts
2493
+ #
2494
+ # Mineralogy + Fluids
2495
+ org = Carbonates(impurity="pure", dict=True).create_organic_matter()
2496
+ quartz = Oxides(impurity="pure", data_type=True).create_quartz()
2497
+ alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
2498
+ plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
2499
+ calcite = Carbonates(impurity="pure", dict=True).create_calcite()
2500
+ dolomite = Carbonates(impurity="pure", dict=True).create_dolomite()
2501
+ siderite = Carbonates(impurity="pure", dict=True).create_siderite()
2502
+ anhydrite = Sulfates(data_type=True).create_anhydrite()
2503
+ gypsum = Sulfates(data_type=True).create_gypsum()
2504
+ pyrite = Sulfides(impurity="pure", dict=True).create_pyrite()
2505
+ illite = Pyllosilicates(impurity="pure", dict=True).create_illite()
2506
+ #
2507
+ mineralogy = [org, quartz, alkalifeldspar, plagioclase, calcite, dolomite, siderite, anhydrite, gypsum, pyrite,
2508
+ illite]
2509
+ #
2510
+ water = fluids.Water.water("")
2511
+ #
2512
+ data = []
2513
+ results = {}
2514
+ #
2515
+ cond = False
2516
+ composition = []
2517
+ while cond == False:
2518
+ if self.amounts == None:
2519
+ w_org = round(0.1/100, 4)
2520
+ w_qz = round(1.3/100, 4)
2521
+ w_kfs = round(0/100, 4)
2522
+ w_pl = round(0/100, 4)
2523
+ w_cal = round(8.1/100, 4)
2524
+ w_dol = round(87/100, 4)
2525
+ w_sd = round(0/100, 4)
2526
+ w_anh = round(0/100, 4)
2527
+ w_gyp = round(0/100, 4)
2528
+ w_py = round(0.1/100, 4)
2529
+ w_ilt = round(1 - w_org - w_qz - w_kfs - w_pl - w_cal - w_dol - w_sd - w_anh - w_gyp - w_py, 4)
2530
+ elif type(self.amounts) is list:
2531
+ w_org = round(abs(np.random.normal(self.amounts[0], 0.025)), 4)
2532
+ w_qz = round(abs(np.random.normal(self.amounts[1], 0.025)), 4)
2533
+ w_kfs = round(abs(np.random.normal(self.amounts[2], 0.025)), 4)
2534
+ w_pl = round(abs(np.random.normal(self.amounts[3], 0.025)), 4)
2535
+ w_cal = round(abs(np.random.normal(self.amounts[4], 0.025)), 4)
2536
+ w_dol = round(abs(np.random.normal(self.amounts[5], 0.025)), 4)
2537
+ w_sd = round(abs(np.random.normal(self.amounts[6], 0.025)), 4)
2538
+ w_anh = round(abs(np.random.normal(self.amounts[7], 0.025)), 4)
2539
+ w_gyp = round(abs(np.random.normal(self.amounts[8], 0.025)), 4)
2540
+ w_py = round(abs(np.random.normal(self.amounts[9], 0.025)), 4)
2541
+ w_ilt = round(1 - w_org - w_qz - w_kfs - w_pl - w_cal - w_dol - w_sd - w_anh - w_gyp - w_py, 4)
2542
+ #
2543
+ if w_org >= 0.0 and w_qz >= 0.0 and w_kfs >= 0.0 and w_pl >= 0.0 and w_cal >= 0.0 and w_dol >= 0.0 \
2544
+ and w_sd >= 0.0 and w_anh >= 0.0 and w_gyp >= 0.0 and w_py >= 0.0 and w_ilt >= 0.0:
2545
+ sumMin = round(w_org + w_qz + w_kfs + w_pl + w_cal + w_dol + w_sd + w_anh + w_gyp + w_py + w_ilt, 4)
2546
+ else:
2547
+ sumMin = 0
2548
+ #
2549
+ w_H = round(w_org*org["chemistry"]["H"] + w_gyp*gypsum["chemistry"]["H"] + w_ilt*illite["chemistry"]["H"], 4)
2550
+ w_C = round(w_org*org["chemistry"]["C"] + w_cal*calcite["chemistry"]["C"] + w_dol*dolomite["chemistry"]["C"] + w_sd*siderite["chemistry"]["C"], 4)
2551
+ w_N = round(w_org*org["chemistry"]["N"], 4)
2552
+ w_Na = round(w_kfs*alkalifeldspar["chemistry"]["Na"] + w_pl*plagioclase["chemistry"]["Na"], 4)
2553
+ w_Mg = round(w_dol*dolomite["chemistry"]["Mg"] + w_ilt*illite["chemistry"]["Mg"], 4)
2554
+ w_Al = round(w_kfs*alkalifeldspar["chemistry"]["Al"] + w_pl*plagioclase["chemistry"]["Al"] + w_ilt*illite["chemistry"]["Al"], 4)
2555
+ w_Si = round(w_qz*quartz["chemistry"]["Si"] + w_kfs*alkalifeldspar["chemistry"]["Si"] + w_pl*plagioclase["chemistry"]["Si"] + w_ilt*illite["chemistry"]["Si"], 4)
2556
+ w_S = round(w_org*org["chemistry"]["S"] + w_py*pyrite["chemistry"]["S"], 4)
2557
+ w_K = round(w_kfs*alkalifeldspar["chemistry"]["K"] + w_ilt*illite["chemistry"]["K"], 4)
2558
+ w_Ca = round(w_pl*plagioclase["chemistry"]["Ca"] + w_cal*calcite["chemistry"]["Ca"] + w_dol*dolomite["chemistry"]["Ca"] + w_anh*anhydrite["chemistry"]["Ca"] + w_gyp*gypsum["chemistry"]["Ca"], 4)
2559
+ w_Fe = round(w_sd*siderite["chemistry"]["Fe"] + w_py*pyrite["chemistry"]["Fe"] + w_ilt*illite["chemistry"]["Fe"], 4)
2560
+ w_O = round(1 - w_H - w_C - w_N - w_Na - w_Mg - w_Al - w_Si - w_S - w_K - w_Ca - w_Fe, 4)
2561
+ sumConc = round(w_H + w_C + w_N + w_O + w_Na + w_Mg + w_Al + w_Si + w_S + w_K + w_Ca + w_Fe, 4)
2562
+ #print("Amount:", sumMin, "C:", sumConc)
2563
+ #
2564
+ if sumMin == 1 and sumConc == 1:
2565
+ cond = True
2566
+ composition.extend((["Org", "Qz", "Kfs", "Pl", "Cal", "Dol", "Sd", "Anh", "Gyp", "Py", "Ilt"]))
2567
+ concentrations = [w_H, w_C, w_N, w_O, w_Na, w_Mg, w_Al, w_Si, w_S, w_K, w_Ca, w_Fe]
2568
+ amounts = [w_org, w_qz, w_kfs, w_pl, w_cal, w_dol, w_sd, w_anh, w_gyp, w_py, w_ilt]
2569
+ else:
2570
+ cond = False
2571
+ #
2572
+ element_list = ["H", "C", "N", "O", "Na", "Mg", "Al", "Si", "S", "K", "Ca", "Fe"]
2573
+ mineral_list = ["Org", "Qz", "Kfs", "Pl", "Cal", "Dol", "Sd", "Anh", "Gyp", "Py", "Ilt"]
2574
+ data.append(composition)
2575
+ results["chemistry"] = {}
2576
+ results["mineralogy"] = {}
2577
+ for index, element in enumerate(element_list, start=0):
2578
+ results["chemistry"][element] = concentrations[index]
2579
+ for index, mineral in enumerate(mineral_list, start=0):
2580
+ results["mineralogy"][mineral] = amounts[index]
2581
+ #
2582
+ rhoSolid = (w_org*org["rho"] + w_qz*quartz["rho"] + w_kfs*alkalifeldspar["rho"] + w_pl*plagioclase["rho"]
2583
+ + w_cal*calcite["rho"] + w_dol*dolomite["rho"] + w_sd*siderite["rho"] + w_anh*anhydrite["rho"]
2584
+ + w_gyp*gypsum["rho"] + w_py*pyrite["rho"] + w_ilt*illite["rho"]) / 1000
2585
+ rhoSolid = 0.975*rhoSolid
2586
+ X = [w_org, w_qz, w_kfs, w_pl, w_cal, w_dol, w_sd, w_anh, w_gyp, w_py, w_ilt]
2587
+ K_list = [mineralogy[i]["K"] for i in range(len(mineralogy))]
2588
+ G_list = [mineralogy[i]["G"] for i in range(len(mineralogy))]
2589
+ K_geo = elast.calc_geometric_mean(self, X, K_list)
2590
+ G_geo = elast.calc_geometric_mean(self, X, G_list)
2591
+ K_solid = 0.35*K_geo
2592
+ G_solid = 0.275*G_geo
2593
+ vP_solid = np.sqrt((K_solid*10**9+4/3*G_solid*10**9)/(rhoSolid*10**3))
2594
+ vS_solid = np.sqrt((G_solid*10**9)/(rhoSolid*10**3))
2595
+ E_solid = (9*K_solid*G_solid)/(3*K_solid+G_solid)
2596
+ nu_solid = (3*K_solid-2*G_solid)/(2*(3*K_solid+G_solid))
2597
+ #
2598
+ if self.porosity == None:
2599
+ if self.actualThickness <= 1000:
2600
+ phi = rd.uniform(0.0, 0.025)
2601
+ elif self.actualThickness > 1000 and self.actualThickness <= 2000:
2602
+ phi = rd.uniform(0.0, 0.025)
2603
+ elif self.actualThickness > 2000 and self.actualThickness <= 3000:
2604
+ phi = rd.uniform(0.0, 0.025)
2605
+ elif self.actualThickness > 3000 and self.actualThickness <= 4000:
2606
+ phi = rd.uniform(0.0, 0.025)
2607
+ elif self.actualThickness > 4000:
2608
+ phi = rd.uniform(0.0, 0.025)
2609
+ else:
2610
+ phi = self.porosity
2611
+ #
2612
+ results["phi"] = phi
2613
+ results["fluid"] = self.fluid
2614
+ #
2615
+ rho = (1 - phi) * rhoSolid + phi * water[2] / 1000
2616
+ vP = (1-phi)*vP_solid + phi*water[4][0]
2617
+ vS = (1 - phi) * vS_solid
2618
+ G_bulk = vS**2 * rho
2619
+ K_bulk = vP**2 * rho - 4/3*G_bulk
2620
+ E_bulk = (9*K_bulk*G_bulk)/(3*K_bulk+G_bulk)
2621
+ phiD = (rhoSolid - rho) / (rhoSolid - water[2] / 1000)
2622
+ phiN = (2 * phi ** 2 - phiD ** 2) ** (0.5)
2623
+ GR = w_org*org["GR"] + w_qz*quartz["GR"] + w_kfs*alkalifeldspar["GR"] + w_pl*plagioclase["GR"] \
2624
+ + w_cal*calcite["GR"] + w_dol*dolomite["GR"] + w_sd*siderite["GR"] + w_anh*anhydrite["GR"] \
2625
+ + w_gyp*gypsum["GR"] + w_py*pyrite["GR"] + w_ilt*illite["GR"]
2626
+ PE = w_org*org["PE"] + w_qz*quartz["PE"] + w_kfs*alkalifeldspar["PE"] + w_pl*plagioclase["PE"] \
2627
+ + w_cal*calcite["PE"] + w_dol*dolomite["PE"] + w_sd*siderite["PE"] + w_anh*anhydrite["PE"] \
2628
+ + w_gyp*gypsum["PE"] + w_py*pyrite["PE"] + w_ilt*illite["PE"]
2629
+ poisson_seismic = 0.5*(vP**2 - 2*vS**2)/(vP**2 - vS**2)
2630
+ poisson_elastic = (3*K_bulk - 2*G_bulk)/(6*K_bulk + 2*G_bulk)
2631
+ poisson_mineralogical = w_org*org["nu"] + w_qz*quartz["nu"] + w_kfs*alkalifeldspar["nu"] + w_pl*plagioclase["nu"] \
2632
+ + w_cal*calcite["nu"] + w_dol*dolomite["nu"] + w_sd*siderite["nu"] + w_anh*anhydrite["nu"] \
2633
+ + w_gyp*gypsum["nu"] + w_py*pyrite["nu"] + w_ilt*illite["nu"]
2634
+ #
2635
+ results["rho"] = round(rho*1000, 4)
2636
+ results["vP"] = round(vP, 4)
2637
+ results["vS"] = round(vS, 4)
2638
+ results["vP/vS"] = round(vP/vS, 4)
2639
+ results["G"] = round(G_bulk*10**(-6), 4)
2640
+ results["K"] = round(K_bulk*10**(-6), 4)
2641
+ results["E"] = round(E_bulk*10**(-6), 4)
2642
+ results["nu"] = round(poisson_mineralogical, 4)
2643
+ results["GR"] = round(GR, 4)
2644
+ results["PE"] = round(PE, 4)
2645
+ #
2646
+ data.append([round(rho, 3), round(rhoSolid, 3), round(water[2] / 1000, 6)])
2647
+ data.append([round(K_bulk*10**(-6), 2), round(G_bulk*10**(-6), 2), round(E_bulk*10**(-6), 2), round(poisson_mineralogical, 3)])
2648
+ data.append([round(vP, 2), round(vS, 2), round(vP_solid, 2), round(water[4][0], 2)])
2649
+ data.append([round(phi, 3), round(phiD, 3), round(phiN, 3)])
2650
+ data.append("water")
2651
+ data.append([round(GR, 3), round(PE, 3)])
2652
+ data.append(concentrations)
2653
+ data.append(amounts)
2654
+ #
2655
+ if dict == False:
2656
+ return data
2657
+ else:
2658
+ return results