VolFe 1.0__tar.gz → 1.0.2__tar.gz

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.
@@ -1,20 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: VolFe
3
- Version: 1.0
3
+ Version: 1.0.2
4
4
  Summary: VolFe
5
5
  Author: Pip Liggins, Penny Wieser
6
6
  Author-email: Ery Hughes <ery.c.hughes@gmail.com>
7
7
  Project-URL: Homepage, https://github.com/eryhughes/VolFe
8
8
  Classifier: Operating System :: OS Independent
9
9
  Classifier: Programming Language :: Python :: 3
10
- Requires-Python: >=3.9
10
+ Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: datetime==5.5
13
13
  Requires-Dist: densityx==1.2.0
14
14
  Requires-Dist: gmpy2==2.2.1
15
- Requires-Dist: numpy<2
15
+ Requires-Dist: numpy==2.2
16
16
  Requires-Dist: pandas==2.2.3
17
- Requires-Dist: PySulfSat==1.0.6
17
+ Requires-Dist: PySulfSat==1.0.11
18
18
  Requires-Dist: scipy>=1.13.1
19
19
  Requires-Dist: tqdm==4.67.1
20
20
  Provides-Extra: dev
@@ -30,20 +30,27 @@ Requires-Dist: ipykernel; extra == "docs"
30
30
 
31
31
  # VolFe
32
32
 
33
- Welcome to VolFe! an open-source framework for calculating melt-vapour equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases.
33
+ Welcome to VolFe! An open-source framework for calculating melt-vapour equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases.
34
34
 
35
35
  [![](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
36
36
  [![PyPI](https://badgen.net/pypi/v/VolFe)](https://pypi.org/project/VolFe/)
37
37
  [![Build Status](https://github.com/eryhughes/VolFe/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/eryhughes/VolFe/actions/workflows/main.yml)
38
38
  [![Documentation Status](https://readthedocs.org/projects/VolFe/badge/?version=latest)](https://VolFe.readthedocs.io/en/latest/?badge=latest)
39
+ [![DOI](https://zenodo.org/badge/646746387.svg)](https://doi.org/10.5281/zenodo.15756761)
40
+
41
+ Read more about the python package in the Volcanica article for the chemistry and speciation calculations (and please cite if you use the package!):
42
+
43
+ Hughes EC, Liggins P, Wieser P, and Stolper EM (2025). VolFe: an open-source Python package for calculating melt-vapor equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases. Volcanica 8(2):457-481 https://doi.org/10.30909/vol/imvc1781
44
+
45
+ The Supplementary Material of the Lithos article explains the isotope calculations (and please additionally cite this paper if you use the isotope calculations):
46
+
47
+ Saper LM, Bromiley G, Cao R, Brounce M, Hughes EC, and Woelki D (2025). The primary magmatic δ34S of the Troodos Ophiolite and evidence for early and late sulfide saturation. Lithos 518-519:108331 https://doi.org/10.1016/j.lithos.2025.108331
39
48
 
40
- Read more about the python package in the Earth ArXiv pre-print (and please cite if you use the package!):
41
- Hughes, E.C., Liggins, P., Wieser, P. and Stolper, E.M., 2024. VolFe: an open-source Python package for calculating melt-vapor equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases. https://doi.org/10.31223/X52X3G
42
49
 
43
50
  For more information and worked examples, see the ReadTheDocs page:
44
51
  https://volfe.readthedocs.io/en/latest/
45
52
 
46
- VolFe can be installed using pip from PyPI or from GitHub (see notes below about installing an editable version).
53
+ VolFe can be installed using pip from PyPI or from GitHub (see notes below about installing an editable version). Please install VolFe in its own environment because it will rewrite all your package versions.
47
54
 
48
55
  ## Development
49
56
 
@@ -1,19 +1,26 @@
1
1
  # VolFe
2
2
 
3
- Welcome to VolFe! an open-source framework for calculating melt-vapour equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases.
3
+ Welcome to VolFe! An open-source framework for calculating melt-vapour equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases.
4
4
 
5
5
  [![](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
6
6
  [![PyPI](https://badgen.net/pypi/v/VolFe)](https://pypi.org/project/VolFe/)
7
7
  [![Build Status](https://github.com/eryhughes/VolFe/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/eryhughes/VolFe/actions/workflows/main.yml)
8
8
  [![Documentation Status](https://readthedocs.org/projects/VolFe/badge/?version=latest)](https://VolFe.readthedocs.io/en/latest/?badge=latest)
9
+ [![DOI](https://zenodo.org/badge/646746387.svg)](https://doi.org/10.5281/zenodo.15756761)
10
+
11
+ Read more about the python package in the Volcanica article for the chemistry and speciation calculations (and please cite if you use the package!):
12
+
13
+ Hughes EC, Liggins P, Wieser P, and Stolper EM (2025). VolFe: an open-source Python package for calculating melt-vapor equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases. Volcanica 8(2):457-481 https://doi.org/10.30909/vol/imvc1781
14
+
15
+ The Supplementary Material of the Lithos article explains the isotope calculations (and please additionally cite this paper if you use the isotope calculations):
16
+
17
+ Saper LM, Bromiley G, Cao R, Brounce M, Hughes EC, and Woelki D (2025). The primary magmatic δ34S of the Troodos Ophiolite and evidence for early and late sulfide saturation. Lithos 518-519:108331 https://doi.org/10.1016/j.lithos.2025.108331
9
18
 
10
- Read more about the python package in the Earth ArXiv pre-print (and please cite if you use the package!):
11
- Hughes, E.C., Liggins, P., Wieser, P. and Stolper, E.M., 2024. VolFe: an open-source Python package for calculating melt-vapor equilibria including silicate melt, carbon, hydrogen, sulfur, and noble gases. https://doi.org/10.31223/X52X3G
12
19
 
13
20
  For more information and worked examples, see the ReadTheDocs page:
14
21
  https://volfe.readthedocs.io/en/latest/
15
22
 
16
- VolFe can be installed using pip from PyPI or from GitHub (see notes below about installing an editable version).
23
+ VolFe can be installed using pip from PyPI or from GitHub (see notes below about installing an editable version). Please install VolFe in its own environment because it will rewrite all your package versions.
17
24
 
18
25
  ## Development
19
26
 
@@ -7,7 +7,7 @@ name = "VolFe"
7
7
  dynamic = ["version"]
8
8
  description = "VolFe"
9
9
  readme = "README.md"
10
- requires-python = ">=3.9"
10
+ requires-python = ">=3.10"
11
11
  authors = [
12
12
  {name = "Ery Hughes", email = "ery.c.hughes@gmail.com"},
13
13
  {name = "Pip Liggins"},
@@ -21,9 +21,9 @@ dependencies = [
21
21
  "datetime==5.5",
22
22
  "densityx==1.2.0",
23
23
  "gmpy2==2.2.1",
24
- "numpy<2",
24
+ "numpy==2.2",
25
25
  "pandas==2.2.3",
26
- "PySulfSat==1.0.6",
26
+ "PySulfSat==1.0.11",
27
27
  "scipy>=1.13.1",
28
28
  "tqdm==4.67.1",
29
29
  ]
@@ -1,5 +1,5 @@
1
1
  __author__ = "Ery Hughes, Pip Liggins, Penny Wieser"
2
- __version__ = "1.0"
2
+ __version__ = "1.0.2"
3
3
 
4
4
  # functions for calculating properties of the melt and gas
5
5
  from .melt_gas import * # noqa F401 F403
@@ -1188,6 +1188,7 @@ def calc_gassing(
1188
1188
  "wm_H2S": 0.0,
1189
1189
  "wm_S2m": 0.0,
1190
1190
  "wm_S6p": 0.0,
1191
+ "wm_SO3": 0.0,
1191
1192
  "ST": 0.0,
1192
1193
  "Fe3FeT": melt_wf["Fe3FeT_i"],
1193
1194
  }
@@ -1195,6 +1196,7 @@ def calc_gassing(
1195
1196
  else:
1196
1197
  P_sat_, conc, frac = c.P_sat(PT, melt_wf, models, psat_tol, nr_step, nr_tol)
1197
1198
  PT["P"] = P_sat_
1199
+ P_sat_initial = P_sat_
1198
1200
  if models.loc["print status", "option"] == "True":
1199
1201
  print("T=", PT["T"], "P=", PT["P"], datetime.datetime.now())
1200
1202
 
@@ -1583,9 +1585,9 @@ def calc_gassing(
1583
1585
  # run over different pressures #
1584
1586
  number_of_step = 0.0
1585
1587
  if models.loc["gassing_direction", "option"] == "degas":
1586
- max_number_of_step = initial
1588
+ max_number_of_step = math.ceil(P_sat_initial)
1587
1589
  elif models.loc["gassing_direction", "option"] == "regas":
1588
- max_number_of_step = final - initial
1590
+ max_number_of_step = final - math.floor(P_sat_initial)
1589
1591
 
1590
1592
  PT["P"] = initial
1591
1593
  last_successful_P = math.floor(PT["P"])
@@ -1598,13 +1600,24 @@ def calc_gassing(
1598
1600
  eq_Fe = models.loc["eq_Fe", "option"]
1599
1601
  # guesses_original = guesses # store original guesses in case the
1600
1602
  # calculation needs to be restarted
1601
- original_guessx, original_guessy, original_guessz, original_guessw = (
1602
- guesses["guessx"],
1603
- guesses["guessy"],
1604
- guesses["guessz"],
1605
- guesses["guessw"],
1606
- )
1607
-
1603
+ original_guesses = {}
1604
+ original_guesses['xgO2'] = guesses['xgO2']
1605
+ original_guesses['xgCO'] = guesses['xgCO']
1606
+ original_guesses['xgH2'] = guesses['xgH2']
1607
+ original_guesses['xgS2'] = guesses['xgS2']
1608
+ original_guesses['xgCO2'] = guesses['xgCO2']
1609
+ original_guesses['xgH2O'] = guesses['xgH2O']
1610
+ original_guesses['xgSO2'] = guesses['xgSO2']
1611
+ original_guesses['xgH2S'] = guesses['xgH2S']
1612
+ original_guesses['xgCH4'] = guesses['xgCH4']
1613
+ original_guesses['xgOCS'] = guesses['xgOCS']
1614
+ original_guesses['xgX'] = guesses['xgX']
1615
+ #original_guessx, original_guessy, original_guessz, original_guessw = (
1616
+ # guesses["guessx"],
1617
+ # guesses["guessy"],
1618
+ # guesses["guessz"],
1619
+ # guesses["guessw"],
1620
+ #)
1608
1621
  if dp_step_choice == "auto":
1609
1622
  if models.loc["gassing_style", "option"] == "open":
1610
1623
  dp_step = 1.0
@@ -1731,14 +1744,24 @@ def calc_gassing(
1731
1744
  # nr_step,nr_tol)
1732
1745
  if xg["xg_O2"] == 1.0:
1733
1746
  guesses = {
1734
- "guessx": original_guessx,
1735
- "guessy": original_guessy,
1736
- "guessz": original_guessz,
1737
- "guessw": original_guessw,
1747
+ "xgO2": original_guesses['xgO2'],
1748
+ "xgCO": original_guesses['xgCO'],
1749
+ "xgH2": original_guesses['xgH2'],
1750
+ "xgS2": original_guesses['xgS2'],
1751
+ "xgCO2": original_guesses['xgCO2'],
1752
+ "xgH2O": original_guesses['xgH2O'],
1753
+ "xgSO2": original_guesses['xgSO2'],
1754
+ "xgH2S": original_guesses['xgH2S'],
1755
+ "xgCH4": original_guesses['xgCH4'],
1756
+ "xgOCS": original_guesses['xgOCS'],
1757
+ "xgX": original_guesses['xgX'],
1738
1758
  }
1739
- if dp_step < 1.0 or dp_step == 1.0:
1759
+ if number_of_step == 1.0:
1760
+ last_successful_P = math.floor(P_sat_initial)
1761
+ elif dp_step < 1.0 or dp_step == 1.0:
1740
1762
  if PT["P"] <= 10.0:
1741
- print("P < 10 bar, trying P = 1 bar")
1763
+ if models.loc["print status", "option"] == "True":
1764
+ print("P < 10 bar, trying P = 1 bar")
1742
1765
  PT["P"] = 1.0
1743
1766
  with warnings.catch_warnings():
1744
1767
  warnings.simplefilter(
@@ -1773,38 +1796,48 @@ def calc_gassing(
1773
1796
  index=False,
1774
1797
  header=True,
1775
1798
  )
1776
- print(
1777
- "solver failed, calculation aborted at P = ",
1778
- last_successful_P,
1779
- datetime.datetime.now(),
1780
- )
1799
+ if models.loc["print status", "option"] == "True":
1800
+ print(
1801
+ "solver failed, calculation aborted at P = ",
1802
+ last_successful_P,
1803
+ datetime.datetime.now(),
1804
+ )
1781
1805
  return results
1782
- print(
1783
- "solver failed at P = ",
1784
- PT["P"],
1785
- "with dp_step = ",
1786
- dp_step,
1787
- ", increasing step size by factor 10",
1788
- )
1806
+ if models.loc["print status", "option"] == "True":
1807
+ print(
1808
+ "solver failed at P = ",
1809
+ PT["P"],
1810
+ "with dp_step = ",
1811
+ dp_step,
1812
+ ", increasing step size by factor 10",
1813
+ )
1789
1814
  dp_step = dp_step * 10.0
1790
1815
  else:
1791
- print(
1792
- "solver failed at P = ",
1793
- PT["P"],
1794
- "with dp_step = ",
1795
- dp_step,
1796
- ", decreasing step size by factor 10",
1797
- )
1816
+ if models.loc["print status", "option"] == "True":
1817
+ print(
1818
+ "solver failed at P = ",
1819
+ PT["P"],
1820
+ "with dp_step = ",
1821
+ dp_step,
1822
+ ", decreasing step size by factor 10",
1823
+ )
1798
1824
  dp_step = dp_step / 10.0
1799
1825
  newP = last_successful_P - dp_step
1800
1826
  if newP < 1.0:
1801
1827
  newP = 1.0
1802
1828
  PT["P"] = newP
1803
1829
  guesses = {
1804
- "guessx": original_guessx,
1805
- "guessy": original_guessy,
1806
- "guessz": original_guessz,
1807
- "guessw": original_guessw,
1830
+ "xgO2": original_guesses['xgO2'],
1831
+ "xgCO": original_guesses['xgCO'],
1832
+ "xgH2": original_guesses['xgH2'],
1833
+ "xgS2": original_guesses['xgS2'],
1834
+ "xgCO2": original_guesses['xgCO2'],
1835
+ "xgH2O": original_guesses['xgH2O'],
1836
+ "xgSO2": original_guesses['xgSO2'],
1837
+ "xgH2S": original_guesses['xgH2S'],
1838
+ "xgCH4": original_guesses['xgCH4'],
1839
+ "xgOCS": original_guesses['xgOCS'],
1840
+ "xgX": original_guesses['xgX'],
1808
1841
  }
1809
1842
  with warnings.catch_warnings():
1810
1843
  warnings.simplefilter(
@@ -1831,21 +1864,29 @@ def calc_gassing(
1831
1864
  models = new_models
1832
1865
  if xg["xg_O2"] == 1.0:
1833
1866
  if dp_step > 1.0:
1834
- print(
1835
- "solver failed at P = ",
1836
- PT["P"],
1837
- "with dp_step = ",
1838
- dp_step,
1839
- ", decreasing step size to 1 bar",
1840
- )
1867
+ if models.loc["print status", "option"] == "True":
1868
+ print(
1869
+ "solver failed at P = ",
1870
+ PT["P"],
1871
+ "with dp_step = ",
1872
+ dp_step,
1873
+ ", decreasing step size to 1 bar",
1874
+ )
1841
1875
  dp_step = 1.0
1842
1876
  newP = last_successful_P - dp_step
1843
1877
  PT["P"] = newP
1844
1878
  guesses = {
1845
- "guessx": original_guessx,
1846
- "guessy": original_guessy,
1847
- "guessz": original_guessz,
1848
- "guessw": original_guessw,
1879
+ "xgO2": original_guesses['xgO2'],
1880
+ "xgCO": original_guesses['xgCO'],
1881
+ "xgH2": original_guesses['xgH2'],
1882
+ "xgS2": original_guesses['xgS2'],
1883
+ "xgCO2": original_guesses['xgCO2'],
1884
+ "xgH2O": original_guesses['xgH2O'],
1885
+ "xgSO2": original_guesses['xgSO2'],
1886
+ "xgH2S": original_guesses['xgH2S'],
1887
+ "xgCH4": original_guesses['xgCH4'],
1888
+ "xgOCS": original_guesses['xgOCS'],
1889
+ "xgX": original_guesses['xgX'],
1849
1890
  }
1850
1891
  with warnings.catch_warnings():
1851
1892
  warnings.simplefilter(
@@ -1870,6 +1911,72 @@ def calc_gassing(
1870
1911
  guesses,
1871
1912
  )
1872
1913
  models = new_models
1914
+ if xg["xg_O2"] == 1.0:
1915
+ if system == "CHOFe":
1916
+ if models.loc["print status", "option"] == "True":
1917
+ print(
1918
+ "solver failed at P = ",
1919
+ PT["P"],
1920
+ "with dp_step = ",
1921
+ dp_step,
1922
+ ", trying O2-CO2 solver",
1923
+ )
1924
+ models.loc["solve_species", "option"] = 'O2-CO2'
1925
+ with warnings.catch_warnings():
1926
+ warnings.simplefilter(
1927
+ "ignore" if suppress_warnings else "default",
1928
+ category=RuntimeWarning,
1929
+ )
1930
+ (
1931
+ xg,
1932
+ conc,
1933
+ melt_and_gas,
1934
+ guesses,
1935
+ new_models,
1936
+ solve_species,
1937
+ mass_balance,
1938
+ ) = eq.mg_equilibrium(
1939
+ PT,
1940
+ melt_wf,
1941
+ bulk_wf,
1942
+ models,
1943
+ nr_step_eq,
1944
+ nr_tol,
1945
+ guesses,
1946
+ )
1947
+ if xg["xg_O2"] == 1.0:
1948
+ if system == "CHOFe":
1949
+ if models.loc["print status", "option"] == "True":
1950
+ print(
1951
+ "solver failed at P = ",
1952
+ PT["P"],
1953
+ "with dp_step = ",
1954
+ dp_step,
1955
+ ", trying O2-H2O solver",
1956
+ )
1957
+ models.loc["solve_species", "option"] = 'O2-H2O'
1958
+ with warnings.catch_warnings():
1959
+ warnings.simplefilter(
1960
+ "ignore" if suppress_warnings else "default",
1961
+ category=RuntimeWarning,
1962
+ )
1963
+ (
1964
+ xg,
1965
+ conc,
1966
+ melt_and_gas,
1967
+ guesses,
1968
+ new_models,
1969
+ solve_species,
1970
+ mass_balance,
1971
+ ) = eq.mg_equilibrium(
1972
+ PT,
1973
+ melt_wf,
1974
+ bulk_wf,
1975
+ models,
1976
+ nr_step_eq,
1977
+ nr_tol,
1978
+ guesses,
1979
+ )
1873
1980
  if xg["xg_O2"] == 1.0:
1874
1981
  results.columns = results.iloc[0]
1875
1982
  results = results[1:]
@@ -1884,6 +1991,7 @@ def calc_gassing(
1884
1991
  datetime.datetime.now(),
1885
1992
  )
1886
1993
  return results
1994
+
1887
1995
  # gas composition
1888
1996
  gas_mf = {
1889
1997
  "O2": xg["xg_O2"],
@@ -1900,6 +2008,22 @@ def calc_gassing(
1900
2008
  "Xg_t": xg["Xg_t"],
1901
2009
  "wt_g": melt_and_gas["wt_g"],
1902
2010
  }
2011
+
2012
+ # update guesses
2013
+ guesses = {
2014
+ "xgO2": xg['xg_O2'],
2015
+ "xgCO": xg['xg_CO'],
2016
+ "xgH2": xg['xg_H2'],
2017
+ "xgS2": xg['xg_S2'],
2018
+ "xgCO2": xg['xg_CO2'],
2019
+ "xgH2O": xg['xg_H2O'],
2020
+ "xgSO2": xg['xg_SO2'],
2021
+ "xgH2S": xg['xg_H2S'],
2022
+ "xgCH4": xg['xg_CH4'],
2023
+ "xgOCS": xg['xg_OCS'],
2024
+ "xgX": xg['xg_X'],
2025
+ }
2026
+
1903
2027
  # else: # NEEDS SORTING ###
1904
2028
  # conc = eq.melt_speciation(PT,melt_wf,models,nr_step,nr_tol)
1905
2029
  # frac = c.melt_species_ratios(conc)
@@ -2168,6 +2292,8 @@ def calc_gassing(
2168
2292
  results_me["wm_S"] = 0.0
2169
2293
  if results_me["wm_X"] < 1.0e-7: # 0.1 ppm X
2170
2294
  results_me["wm_X"] = 0.0
2295
+ if results_me["wm_C"] == 0.0 and results_me["wm_H"] == 0.0 and results_me["wm_S"] == 0.0 and results_me["wm_X"] == 0.:
2296
+ break
2171
2297
  bulk_wf = {
2172
2298
  "C": results_me["wm_C"],
2173
2299
  "H": results_me["wm_H"],
@@ -2217,7 +2343,7 @@ def calc_gassing(
2217
2343
  "Fe": wt_Fe_ * (1.0 / (1.0 - Xst)),
2218
2344
  "Wt": wt_ * (1.0 - Xst),
2219
2345
  }
2220
-
2346
+
2221
2347
  tqdmsteps.update(abs(dp_step))
2222
2348
 
2223
2349
  if models.loc["gassing_direction", "option"] == "regas":
@@ -2270,7 +2396,7 @@ def calc_isobar(
2270
2396
 
2271
2397
  Outputs
2272
2398
  -------
2273
- If output csv = yes in models, results_gassing_chemistry: csv file
2399
+ If output csv = yes in models, results_isobars: csv file
2274
2400
  """
2275
2401
  if models.loc["COH_species", "option"] == "H2O-CO2 only":
2276
2402
  PT = {"T": setup.loc[run, "T_C"]}
@@ -2303,6 +2429,65 @@ def calc_isobar(
2303
2429
 
2304
2430
  return results
2305
2431
 
2432
+ ###########################
2433
+ # calculate isopleths #####
2434
+ ###########################
2435
+ def calc_isopleth(
2436
+ setup,
2437
+ run=0,
2438
+ models=mdv.default_models,
2439
+ final_P=10000.0,
2440
+ step_XH2O=0.2,
2441
+ ):
2442
+ """Calculates H2O-CO2-only isopleths for given T, melt composition, up to a final P,
2443
+ and XH2O step-size.
2444
+
2445
+ Args:
2446
+ setup (pandas.DataFrame): Melt composition to be used, requires following headers (notes in [] are not part of the headers): Sample; T_C; DNNO or DFMQ or logfO2 or (Fe2O3 and FeO) or Fe3FeT or S6ST; SiO2, TiO2, Al2O3, (Fe2O3T or FeOT unless Fe2O3 and FeO given), MnO, MgO, CaO, Na2O, K2O, P2O5[concentrations are in wt%].
2447
+ run (int, optional): Integer of the row in the setup file to run (note the first row under the headers is row 0). Defaults to 0.
2448
+ models (_type_, optional): Model options. Defaults to mdv.default_models.
2449
+ final_P (float, optional): Final pressure in bar for isobar calculation. Defaults to 10000.0.
2450
+ step_XH2O (float, optional): XH2O step in mole fraction for calculating isopleths. Defaults to 0.20.
2451
+
2452
+ Returns:
2453
+ pandas.DataFrame: Results from isopleth calculation
2454
+
2455
+
2456
+ Outputs
2457
+ -------
2458
+ If output csv = yes in models, results_isopleth: csv file
2459
+ """
2460
+ if models.loc["COH_species", "option"] == "H2O-CO2 only":
2461
+ PT = {"T": setup.loc[run, "T_C"]}
2462
+ PT['P'] = final_P
2463
+
2464
+ # check if any options need to be read from the setup file rather than the
2465
+ # models file
2466
+ models = options_from_setup(run, models, setup)
2467
+
2468
+ # set up results table
2469
+ results = pd.DataFrame([["XH2O","P_bar", "H2O_wtpc", "CO2_ppm"]])
2470
+
2471
+ no_XH2O = int(1./step_XH2O)
2472
+ melt_wf = mg.melt_comp(run, setup)
2473
+
2474
+ for n in range(1, no_XH2O, 1):
2475
+ XH2O = n*step_XH2O
2476
+ results1 = c.calc_isopleth_CO2H2O(XH2O,PT, melt_wf, models)
2477
+ results = pd.concat([results, results1], ignore_index=True)
2478
+ if models.loc["print status", "option"] == "True":
2479
+ print(setup.loc[run, "Sample"], n)
2480
+ PT['P'] = final_P
2481
+ results.columns = results.iloc[0]
2482
+ results = results[1:]
2483
+
2484
+ else:
2485
+ raise TypeError("COH_species option must be H2O-CO2 only")
2486
+ if models.loc["output csv", "option"] == "True":
2487
+ results.to_csv("results_isopleths.csv", index=False, header=False)
2488
+
2489
+ return results
2490
+
2306
2491
 
2307
2492
  #################################
2308
2493
  # calculate pure solubility #####