This page was generated from docs/Examples/3a. SfO2 1MI_df.ipynb. Interactive online version: Binder badge.

Python Notebook Download

3a. Calculate fO2 from melt ST for a single melt composition from a dataframe using default options

Python set-up

You need to install VolFe once on your machine, if you haven’t yet. Then we need to import a few Python packages (including VolFe).

[7]:
# Install VolFe on your machine. Don't remove the # from this line!
# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.

# import python packages
import pandas as pd
import matplotlib.pyplot as plt
import VolFe as vf

Define the inputs

At a minimum to run an S-2-fO2 calculation, we need a dataframe of the melt composition and Fe in the melt [note 1], and temperature:

  • Sample is just the name for this analysis.

  • Temperature is in °C.

  • Volatile-free melt composition is in wt% oxides [note 2]. All these oxides must be present in the dataframe, so set them to 0. if you have no data for them (although see [note 1] around FeOT).

  • H2O is all hydrogen in the melt reported as H2O in wt% [note 3].

  • CO2ppm is all carbon in the melt reported as CO2 in ppm [note 3].

  • STppm is all sulfur in the melt reported as S in ppm [note 3].

  • Xppm is all “X” in the melt reported as “X” in ppm [note 3]. “X” is an unreactive melt species whose identity can be changed - this is explored Example 1d.

[note 1] In this example we specify Fe in the melt as FeOT - other options are possible, such as Fe2O3,T or FeO and Fe2O3.

[note 2] It does not matter what the non-volatile oxides sum too - they are renormalised to 100 wt% minus the total of the volatiles (i.e., H2O + CO2 + ST + “X”).

[note 3] The volatile concentrations are absolute for the melt = i.e., the non-volatile melt composition is normalised to 100 wt% minus the volatiles. The volatiles are not added to the oxides and then renormalised.

The following composition is analysis Sari15-04-34 from Brounce et al. (2014), with a temperature chosen as 1200 °C. We’ll run at Pvsat (based on the volatile content) for now so we don’t have to specify a P.

[8]:
# Define the melt composition and T as a dictionary.
my_analysis = {'Sample':'Sari15-04-34',
           'T_C': 1200., # Temperature in 'C
           'SiO2': 46.94, # wt%
           'TiO2': 0.65, # wt%
           'Al2O3': 16.0, # wt%
           'FeOT': 8.92, # wt%
           'MnO': 0.15, # wt%
           'MgO': 7.3, # wt%
           'CaO': 13.94, # wt%
           'Na2O': 1.61, # wt%
           'K2O': 0.26, # wt%
           'P2O5': 0.07, # wt%
           'H2O': 3.83, # wt%
           'CO2ppm': 1109., # ppm
           'STppm': 1614.12, # ppm
           'Xppm': 0.} # ppm

# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])

# Show the DataFrame.
print(my_analysis)
         Sample     T_C   SiO2  TiO2  Al2O3  FeOT   MnO  MgO    CaO  Na2O  \
0  Sari15-04-34  1200.0  46.94  0.65   16.0  8.92  0.15  7.3  13.94  1.61

    K2O  P2O5   H2O  CO2ppm    STppm  Xppm
0  0.26  0.07  3.83  1109.0  1614.12   0.0

For this example we will use the default options in VolFe, which can be found below:

[9]:
# print default options in VolFe
print(vf.default_models)
                            option
type
COH_species     yes_H2_CO_CH4_melt
H2S_m                         True
species X                       Ar
Hspeciation                   none
fO2                       Kress91A
...                            ...
error                          0.1
print status                 False
output csv                    True
setup                        False
high precision               False

[78 rows x 1 columns]

Run the calculation

At Pvsat

And below runs the calculation - it outputs a dataframe of the full results. So in this example, the sample would be sulfide-saturated but doesn’t have enough sulfur to be anhydrite saturated.

[10]:
# runs the calculation
vf.calc_melt_S_oxybarometer(my_analysis)
[10]:
sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt carbonylsulfide opt density opt Date
0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 3209.679276 1071.669795 True 0.905944 ... Ohmoto97 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 COS DensityX 2025-02-02 12:10:37.752486

1 rows × 67 columns

At specified P

Alternatively, we can specify the pressure of the calculation by adding “P_bar” to the dataframe.

The calculation is not iterative yet (work in progress) which means you also have to specify Fe3+/FeT of the melt so it can calculate S2-CSS and S6+CAS…

Note that if this is below Pvsat for the volatile content, the melt composition is metastable because a vapor would be present, lowering the volatile content of the melt.

[5]:
# Define the melt composition, P, and T as a dictionary.
my_analysis = {'Sample':'Sari15-04-34',
           'T_C': 1200., # Temperature in 'C
           'SiO2': 46.94, # wt%
           'TiO2': 0.65, # wt%
           'Al2O3': 16.0, # wt%
           'FeOT': 8.92, # wt%
           'MnO': 0.15, # wt%
           'MgO': 7.3, # wt%
           'CaO': 13.94, # wt%
           'Na2O': 1.61, # wt%
           'K2O': 0.26, # wt%
           'P2O5': 0.07, # wt%
           'H2O': 3.83, # wt%
           'CO2ppm': 1109., # ppm
           'STppm': 1614.12, # ppm
           'Xppm': 0., # ppm
           'P_bar': 1000., # bar
           'Fe3FeT': 0.1}

# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])

# runs the calculation
vf.calc_melt_S_oxybarometer(my_analysis)
[5]:
sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt carbonylsulfide opt density opt Date
0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 1000.0 930.456494 possible 1.158861 ... Ohmoto97 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 COS DensityX 2025-02-02 09:58:12.197469

1 rows × 67 columns

Specifying sulfide composition

The sulfide composition (i.e., fractions of Fe, Ni, and Cu) change the S2-CSS, which is incoporated into some parameterisations of S2-CSS (see Wieser & Gleeson, 2023, for an overview).

If nothing about the sulfide composition is specified, VolFe assumes the sulfide is pure FeS. However, the composition of the sulfide can be specified in the input dataframe using “sulf_XFe”, “sulf_XCu”, and “sulf_XNi” as the mole fractions of FeS, CuS, and NiS in the sulfide, as shown below.

[6]:
# Define the melt composition, sulfide composition, and T as a dictionary.
my_analysis = {'Sample':'Sari15-04-34',
           'T_C': 1200., # Temperature in 'C
           'SiO2': 46.94, # wt%
           'TiO2': 0.65, # wt%
           'Al2O3': 16.0, # wt%
           'FeOT': 8.92, # wt%
           'MnO': 0.15, # wt%
           'MgO': 7.3, # wt%
           'CaO': 13.94, # wt%
           'Na2O': 1.61, # wt%
           'K2O': 0.26, # wt%
           'P2O5': 0.07, # wt%
           'H2O': 3.83, # wt%
           'CO2ppm': 1109., # ppm
           'STppm': 1614.12, # ppm
           'Xppm': 0., # ppm
           'sulf_XFe': 0.8,
           'sulf_XCu': 0.15,
           'sulf_XNi': 0.05}

# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])

# runs the calculation
vf.calc_melt_S_oxybarometer(my_analysis)
[6]:
sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt carbonylsulfide opt density opt Date
0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 3223.517523 867.284719 True 1.023231 ... Ohmoto97 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 COS DensityX 2025-02-02 09:59:13.344561

1 rows × 67 columns