PetThermoTools 0.2.39__py3-none-any.whl → 0.2.40__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.
@@ -4,214 +4,347 @@ from PetThermoTools.Path import *
4
4
 
5
5
  def isobaric_crystallisation(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
6
6
  T_path_C = None, T_start_C = None, T_end_C = None, dt_C = None,
7
- P_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None,
7
+ P_bar = None, Fe3Fet_init = None, Fe3Fet_Liq = None,
8
+ H2O_init = None, CO2_init = None, H2O_Liq = None, CO2_Liq = None,
8
9
  find_liquidus = None, fO2_buffer = None, fO2_offset = None,
9
10
  label = None, Crystallinity_limit = None, fluid_sat = None, timeout = None,
10
- Suppress = ['rutile', 'tridymite'], Suppress_except=False):
11
- '''
12
- Simulates isobaric crystallization paths by calling the `multi_path` function, which computes the phase equilibria between solid, liquid, and fluid phases under specified conditions.
11
+ Suppress = ['rutile', 'tridymite'], Suppress_except=False,
12
+ multi_processing = True):
13
+ """
14
+ Simulates isobaric (constant-pressure) crystallization paths using the `multi_path` function.
13
15
 
14
16
  Parameters
15
17
  ----------
16
- Model: str, optional
17
- The thermodynamic model to use for calculations. Options include:
18
- - "Holland" for Holland et al. phase equilibrium models.
19
- - MELTS versions can be specified as "MELTSv1.0.2", "MELTSv1.1.0", "MELTSv1.2.0", or "pMELTS". Default is "MELTSv1.0.2".
20
- bulk: dict or pandas.DataFrame
21
- The initial bulk composition for the calculations. If a dictionary is provided, it is used for all calculations. If a DataFrame is provided, it can handle multiple compositions, with rows corresponding to different calculations.
22
- Frac_solid: bool, optional
23
- If True, solid phases are fractionated (removed) after each step of crystallization. Default is False.
24
- Frac_fluid: bool, optional
25
- If True, fluid phases are fractionated (removed) after each step. Default is False.
26
- T_path_C: float or numpy.ndarray, optional
27
- Temperature path for non-linear temperature steps. If specified, overrides the use of `T_start_C`, `T_end_C`, and `dt_C`.
28
- T_start_C: float, optional
29
- The starting temperature for crystallization, in degrees Celsius.
30
- T_end_C: float, optional
31
- The final temperature for crystallization, in degrees Celsius.
32
- dt_C: float, optional
33
- The temperature step size for each iteration, in degrees Celsius.
34
- P_bar: float or numpy.ndarray, optional
35
- The pressure at which crystallization occurs, in bars. Default assumes constant pressure (isobaric conditions).
36
- Fe3Fet_Liq: float or numpy.ndarray, optional
37
- The initial Fe³⁺/ΣFe ratio in the melt phase. If an array is provided, each entry corresponds to a different bulk composition. If None, this value must be specified in `bulk` or by using an oxygen fugacity buffer.
38
- H2O_Liq: float or numpy.ndarray, optional
39
- Initial H₂O content in the melt phase. Similar to `Fe3Fet_Liq`, an array can specify different water contents for each bulk composition.
40
- CO2_Liq: float or numpy.ndarray, optional
41
- Initial CO₂ content in the melt phase. Similar in usage to `H2O_Liq`.
42
- find_liquidus: bool, optional
43
- If True, the starting temperature is adjusted to the liquidus temperature of the system before crystallization. Default is False.
44
- fO2_buffer: str, optional
45
- Specifies an oxygen fugacity buffer to control the system's redox state. Options include "FMQ" (Fayalite-Magnetite-Quartz) or "NNO" (Nickel-Nickel Oxide).
46
- fO2_offset: float or numpy.ndarray, optional
47
- Log units of offset from the chosen `fO2_buffer`. For instance, an offset of -1 means 1 log unit below the buffer.
48
- label: str, optional
49
- A label or identifier for the simulation run. Useful for tracking multiple results.
50
- Crystallinity_limit: float, optional
51
- If specified, the simulation will stop when the total crystallinity (solid fraction) reaches the given limit.
52
- fluid_sat: bool, optional
53
- If True, the calculation starts from fluid saturation but no excess volatile phase is present initially. Default is False.
54
- timeout: float, optional
55
- Maximum allowed time for the simulation in seconds. If exceeded, the calculation will terminate early.
18
+ Model : str, optional
19
+ Thermodynamic model, options:
20
+ MELTS:
21
+ "pMELTS"
22
+ "MELTSv1.0.2"
23
+ "MELTSv1.1.0"
24
+ "MELTSv1.2.0"
25
+ MAGEMin:
26
+ "Green2025"
27
+ "Weller2024"
28
+ bulk : dict or pandas.DataFrame
29
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
30
+ Frac_solid : bool, optional
31
+ If True, solid phases are fractionated. Default is False.
32
+ Frac_fluid : bool, optional
33
+ If True, fluid phases are fractionated. Default is False.
34
+ T_path_C : float or ndarray, optional
35
+ Custom temperature path. Overrides T_start_C, T_end_C, dt_C.
36
+ T_start_C, T_end_C, dt_C : float, optional
37
+ Linear temperature path definition.
38
+ P_bar : float or ndarray, optional
39
+ Pressure in bars for isobaric conditions.
40
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
41
+ Initial redox and volatile content of the system.
42
+ find_liquidus : bool, optional
43
+ If True, starts at the liquidus. Default is False.
44
+ fO2_buffer : str, optional
45
+ Redox buffer (e.g., "FMQ", "NNO").
46
+ fO2_offset : float or ndarray, optional
47
+ Log unit offset from fO2 buffer.
48
+ label : str, optional
49
+ Label for the run.
50
+ Crystallinity_limit : float, optional
51
+ Stops if total crystallinity exceeds this value.
52
+ fluid_sat : bool, optional
53
+ If True, begins at fluid saturation. Default is False.
54
+ timeout : float, optional
55
+ Maximum runtime in seconds per calculation.
56
+ Suppress : list of str, optional
57
+ Phases to suppress. Default ['rutile', 'tridymite'].
58
+ Suppress_except : bool, optional
59
+ If True, suppresses all phases except those listed.
60
+ multi_processing : bool, optional
61
+ Enables multiprocessing. Default is True.
56
62
 
57
63
  Returns
58
64
  -------
59
- Results : dict
60
- Dictionary containing results of the isothermal decompression simulation, with compositions
61
- and thermodynamic properties for each step contained within phase-specific dataframes.
62
- '''
65
+ dict
66
+ A dictionary of results with DataFrames for each phase.
67
+ """
68
+ if H2O_Liq is not None:
69
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
70
+ if H2O_init is None:
71
+ H2O_init = H2O_Liq
72
+
73
+ if CO2_Liq is not None:
74
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
75
+ if CO2_init is None:
76
+ CO2_init = CO2_Liq
77
+
78
+ if Fe3Fet_Liq is not None:
79
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
80
+ if Fe3Fet_init is None:
81
+ Fe3Fet_init = Fe3Fet_Liq
82
+
63
83
  comp = bulk.copy()
64
84
 
65
85
  Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
66
86
  T_path_C = T_path_C, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C,
67
- P_bar = P_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq,
87
+ P_bar = P_bar, Fe3Fet_init = Fe3Fet_init, H2O_init = H2O_init, CO2_init = CO2_init,
68
88
  find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset,
69
89
  label = label, Crystallinity_limit = Crystallinity_limit, fluid_sat = fluid_sat,
70
- timeout = timeout, Suppress = Suppress, Suppress_except=Suppress_except)
90
+ timeout = timeout, Suppress = Suppress, Suppress_except=Suppress_except,
91
+ multi_processing = multi_processing)
71
92
 
72
93
  return Results
73
94
 
74
95
  def isochoric_crystallisation(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
75
96
  T_path_C = None, T_start_C = None, T_end_C = None, dt_C = None,
76
- P_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None,
97
+ P_bar = None, Fe3Fet_init = None, Fe3Fet_Liq = None,
98
+ H2O_init = None, H2O_Liq = None, CO2_init = None, CO2_Liq = None,
77
99
  find_liquidus = None, fO2_buffer = None, fO2_offset = None,
78
100
  label = None, Crystallinity_limit = None, fluid_sat = None,
79
- timeout = None, Suppress = ['rutile', 'tridymite'], Suppress_except=False):
80
- '''
81
- Computes isochorics crystallization paths using the multi_path function,which
82
- computes the phase equilibria between solid, liquid and fluid phases.
83
-
84
- Model: string
85
- "MELTS" or "Holland". Dictates whether MELTS or MAGEMin calculations are performed. Default "MELTS".
86
- Version of melts can be specified "MELTSv1.0.2", "MELTSv1.1.0", "MELTSv1.2.0", or "pMELTS". Default "v.1.0.2".
87
-
88
- bulk: Dict or pd.DataFrame
89
- Initial compositon for calculations. If type == Dict, the same initial composition will be used in all calculations.
90
-
91
- Frac_solid: True/False
92
- If True, solid phases will be removed from the system at the end of each step. Default False.
93
-
94
- Frac_fluid: True/False
95
- If True, fluid phases will be removed from the system at the end of each step. Default False.
96
-
97
- T_path_C: float or np.ndarray
98
- Used to specify the temperature path if non constant steps are used.
99
-
100
- T_start_C: float or np.ndarray
101
- Initial temperature used for path calculations.
102
-
103
- T_end_C: float or np.ndarray
104
- Final temperature in crystallisation calculations.
105
-
106
- dt_C: float or np.ndarray
107
- Temperature increment during crystallisation calculations.
108
-
109
- P_bar: float or np.ndarray
110
- Calculation pressure - typically used when calculations are performed at a fixed P (e.g.,isobaric crystallisation).
111
-
112
- Fe3Fet_Liq: float or np.ndarray
113
- Fe 3+/total ratio. If type(comp) == dict, and type(Fe3Fet_Liq) == np.ndarray a new DataFrame will be constructed with bulk compositions varying only in their Fe3Fet_Liq value. If comp is a pd.DataFrame, a single Fe3Fet_Liq value may be passed (float) and will be used as the Fe redox state for all starting compostions, or an array of Fe3Fet_Liq values, equal to the number of compositions specified in comp can specify a different Fe redox state for each sample. If None, the Fe redox state must be specified in the comp variable or an oxygen fugacity buffer must be chosen.
114
-
115
- H2O_Liq: float or np.ndarray
116
- H2O content of the initial melt phase. If type(comp) == dict, and type(H2O_Liq) = np.ndarray a new DataFrame will be constructed with bulk compositions varying only in their H2O_Liq value. If comp is a pd.DataFrame, a single H2O_Liq value may be passes (float) and will be used as the initial melt H2O content for all starting compositions. Alternatively, if an array of H2O_Liq values is passed, equal to the number of compositions specified in comp, a different initial melt H2O value will be passed for each sample. If None, H2O_Liq must be specified in the comp variable.
117
-
118
- find_liquidus: True/False
119
- If True, the calculations will start with a search for the melt liquidus temperature. Default is False.
101
+ timeout = None, Suppress = ['rutile', 'tridymite'], Suppress_except=False,
102
+ multi_processing = True):
103
+ """
104
+ Simulates isochoric (constant-volume) crystallization paths using the `multi_path` function.
120
105
 
121
- fO2_buffer: string
122
- If the oxygen fugacity of the system is to be buffered during crystallisation/decompression, then an offset to a known buffer must be specified. Here the user can define the known buffer as either "FMQ" or "NNO".
106
+ Parameters
107
+ ----------
108
+ Model : str, optional
109
+ Thermodynamic model, options:
110
+ MELTS:
111
+ "pMELTS"
112
+ "MELTSv1.0.2"
113
+ "MELTSv1.1.0"
114
+ "MELTSv1.2.0"
115
+ bulk : dict or pandas.DataFrame
116
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
117
+ Frac_solid : bool, optional
118
+ If True, solid phases are fractionated. Default is False.
119
+ Frac_fluid : bool, optional
120
+ If True, fluid phases are fractionated. Default is False.
121
+ T_path_C : float or ndarray, optional
122
+ Custom temperature path. Overrides T_start_C, T_end_C, dt_C.
123
+ T_start_C, T_end_C, dt_C : float, optional
124
+ Linear temperature path definition.
125
+ P_bar : float or ndarray, optional
126
+ Pressure in bars for initial condition.
127
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
128
+ Initial redox and volatile content of the system.
129
+ find_liquidus : bool, optional
130
+ If True, starts at the liquidus. Default is False.
131
+ fO2_buffer : str, optional
132
+ Redox buffer (e.g., "FMQ", "NNO").
133
+ fO2_offset : float or ndarray, optional
134
+ Log unit offset from fO2 buffer.
135
+ label : str, optional
136
+ Label for the run.
137
+ Crystallinity_limit : float, optional
138
+ Stops if total crystallinity exceeds this value.
139
+ fluid_sat : bool, optional
140
+ If True, begins at fluid saturation. Default is False.
141
+ timeout : float, optional
142
+ Maximum runtime in seconds per calculation.
143
+ Suppress : list of str, optional
144
+ Phases to suppress. Default ['rutile', 'tridymite'].
145
+ Suppress_except : bool, optional
146
+ If True, suppresses all phases except those listed.
147
+ multi_processing : bool, optional
148
+ Enables multiprocessing. Default is True.
123
149
 
124
- fO2_offset: float or np.ndarray
125
- Offset from the buffer spcified in fO2_buffer (log units).
150
+ Returns
151
+ -------
152
+ dict
153
+ A dictionary of results with DataFrames for each phase.
154
+ """
155
+ if H2O_Liq is not None:
156
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
157
+ if H2O_init is None:
158
+ H2O_init = H2O_Liq
126
159
 
127
- Crystallinity_limit: float
128
- If not none, the calculation will stop once the weight fraction of crytals in the system exceeds the number specified.
160
+ if CO2_Liq is not None:
161
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
162
+ if CO2_init is None:
163
+ CO2_init = CO2_Liq
129
164
 
130
- fluid_sat: True/False
131
- If True, the calculation will start at the fluid saturated liquidus, but no excess volatile phase will be present at the start of the calculation.
165
+ if Fe3Fet_Liq is not None:
166
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
167
+ if Fe3Fet_init is None:
168
+ Fe3Fet_init = Fe3Fet_Liq
132
169
 
133
- Returns:
134
- ----------
135
- Results: Dict
136
- Dictionary where each entry represents the results of a single calculation. Within the dictionary each single calculation is reported as a series of pandas DataFrames, displaying the composition and thermodynamic properties of each phase.
137
- '''
138
170
  comp = bulk.copy()
139
171
 
140
172
  Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
141
173
  T_path_C = T_path_C, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C,
142
- P_bar = P_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq=CO2_Liq,
174
+ P_bar = P_bar, Fe3Fet_init = Fe3Fet_init, H2O_init = H2O_init, CO2_init=CO2_init,
143
175
  find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset,
144
176
  label = label, Crystallinity_limit = Crystallinity_limit, fluid_sat = fluid_sat,
145
- timeout = timeout, isochoric = True, Suppress = Suppress, Suppress_except=Suppress_except)
177
+ timeout = timeout, isochoric = True, Suppress = Suppress, Suppress_except=Suppress_except,
178
+ multi_processing=multi_processing)
146
179
 
147
180
  return Results
148
181
 
149
- def polybaric_crystallisation_path(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_start_C = None, T_end_C = None, dt_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None):
150
- '''
151
- Computes polybaric crystallization paths using the multi_path function, which
152
- computes the phase equilibria between solid, liquid and fluid phases, where
153
- pressure and temperature both change continuously throughout the crystallization
154
- model.
155
-
156
- Model: string
157
- "MELTS" or "Holland". Dictates whether MELTS or MAGEMin calculations are performed. Default "MELTS".
158
- Version of melts can be specified "MELTSv1.0.2", "MELTSv1.1.0", "MELTSv1.2.0", or "pMELTS". Default "v.1.0.2".
159
-
160
- bulk: Dict or pd.DataFrame
161
- Initial compositon for calculations. If type == Dict, the same initial composition will be used in all calculations.
162
-
163
- Frac_solid: True/False
164
- If True, solid phases will be removed from the system at the end of each step. Default False.
165
-
166
- Frac_fluid: True/False
167
- If True, fluid phases will be removed from the system at the end of each step. Default False.
168
-
169
- T_start_C: float or np.ndarray
170
- Initial temperature used for path calculations.
171
-
172
- T_end_C: float or np.ndarray
173
- Final temperature in crystallisation calculations.
174
-
175
- dt_C: float or np.ndarray
176
- Temperature increment during crystallisation calculations.
182
+ def polybaric_crystallisation_path(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
183
+ T_path_C = None, T_start_C = None, T_end_C = None, dt_C = None,
184
+ P_path_bar = None, P_start_bar = None, P_end_bar = None, dp_bar = None,
185
+ Fe3Fet_init = None, Fe3Fet_Liq = None, H2O_init = None, H2O_Liq = None,
186
+ CO2_init = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None,
187
+ fO2_offset = None, label = None, timeout = None, multi_processing=True,
188
+ Suppress = ['rutile', 'tridymite'], Suppress_except=False):
189
+ """
190
+ Simulates polybaric crystallization along a user-specified P-T path using the `multi_path` function.
177
191
 
178
- P_start_bar: float or np.ndarray
179
- Initial pressure used for path calculations.
192
+ Parameters
193
+ ----------
194
+ Model : str, optional
195
+ Thermodynamic model, options:
196
+ MELTS:
197
+ "pMELTS"
198
+ "MELTSv1.0.2"
199
+ "MELTSv1.1.0"
200
+ "MELTSv1.2.0"
201
+ MAGEMin:
202
+ "Green2025"
203
+ "Weller2024"
204
+ bulk : dict or pandas.DataFrame
205
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
206
+ Frac_solid : bool, optional
207
+ If True, solid phases are fractionated. Default is False.
208
+ Frac_fluid : bool, optional
209
+ If True, fluid phases are fractionated. Default is False.
210
+ T_path_C : ndarray, optional
211
+ Custom temperature path. Overrides T_start_C, T_end_C, dt_C.
212
+ T_start_C, T_end_C, dt_C : float, optional
213
+ Linear temperature path definition.
214
+ P_path_bar : ndarray, optional
215
+ Pressure path in bars for polybaric conditions.
216
+ P_start_bar, P_end_bar, dp_bar : float, optional
217
+ Linear pressure path definition.
218
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
219
+ Initial redox and volatile content of the system.
220
+ find_liquidus : bool, optional
221
+ If True, starts at the liquidus. Default is False.
222
+ fO2_buffer : str, optional
223
+ Redox buffer (e.g., "FMQ", "NNO").
224
+ fO2_offset : float or ndarray, optional
225
+ Log unit offset from fO2 buffer.
226
+ label : str, optional
227
+ Label for the run.
228
+ Crystallinity_limit : float, optional
229
+ Stops if total crystallinity exceeds this value.
230
+ fluid_sat : bool, optional
231
+ If True, begins at fluid saturation. Default is False.
232
+ timeout : float, optional
233
+ Maximum runtime in seconds per calculation.
234
+ Suppress : list of str, optional
235
+ Phases to suppress. Default ['rutile', 'tridymite'].
236
+ Suppress_except : bool, optional
237
+ If True, suppresses all phases except those listed.
238
+ multi_processing : bool, optional
239
+ Enables multiprocessing. Default is True.
180
240
 
181
- P_end_bar: float or np.ndarray
182
- Final pressure in crystallisation calculations. If T_end_C is not None this value will not be used.
241
+ Returns
242
+ -------
243
+ dict
244
+ A dictionary of results with DataFrames for each phase.
245
+ """
246
+ if H2O_Liq is not None:
247
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
248
+ if H2O_init is None:
249
+ H2O_init = H2O_Liq
183
250
 
184
- dp_bar: float or np.ndarray
185
- Pressure increment during crystallisation calculations.
251
+ if CO2_Liq is not None:
252
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
253
+ if CO2_init is None:
254
+ CO2_init = CO2_Liq
186
255
 
187
- Fe3Fet_Liq: float or np.ndarray
188
- Fe 3+/total ratio. If type(comp) == dict, and type(Fe3Fet_Liq) == np.ndarray a new DataFrame will be constructed with bulk compositions varying only in their Fe3Fet_Liq value. If comp is a pd.DataFrame, a single Fe3Fet_Liq value may be passed (float) and will be used as the Fe redox state for all starting compostions, or an array of Fe3Fet_Liq values, equal to the number of compositions specified in comp can specify a different Fe redox state for each sample. If None, the Fe redox state must be specified in the comp variable or an oxygen fugacity buffer must be chosen.
256
+ if Fe3Fet_Liq is not None:
257
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
258
+ if Fe3Fet_init is None:
259
+ Fe3Fet_init = Fe3Fet_Liq
189
260
 
190
- H2O_Liq: float or np.ndarray
191
- H2O content of the initial melt phase. If type(comp) == dict, and type(H2O_Liq) = np.ndarray a new DataFrame will be constructed with bulk compositions varying only in their H2O_Liq value. If comp is a pd.DataFrame, a single H2O_Liq value may be passes (float) and will be used as the initial melt H2O content for all starting compositions. Alternatively, if an array of H2O_Liq values is passed, equal to the number of compositions specified in comp, a different initial melt H2O value will be passed for each sample. If None, H2O_Liq must be specified in the comp variable.
261
+ comp = bulk.copy()
192
262
 
193
- find_liquidus: True/False
194
- If True, the calculations will start with a search for the melt liquidus temperature. Default is False.
263
+ Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
264
+ T_path_C = T_path_C, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C,
265
+ P_path_bar = P_path_bar, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar,
266
+ Fe3Fet_init = Fe3Fet_init, H2O_init = H2O_init, CO2_init = CO2_init, find_liquidus = find_liquidus,
267
+ fO2_buffer = fO2_buffer, fO2_offset = fO2_offset,
268
+ label = label, timeout = timeout, Suppress = Suppress, Suppress_except=Suppress_except,
269
+ multi_processing=multi_processing)
195
270
 
196
- fO2_buffer: string
197
- If the oxygen fugacity of the system is to be buffered during crystallisation/decompression, then an offset to a known buffer must be specified. Here the user can define the known buffer as either "FMQ" or "NNO".
271
+ return Results
198
272
 
199
- fO2_offset: float or np.ndarray
200
- Offset from the buffer spcified in fO2_buffer (log units).
273
+ def polybaric_crystallisation_onestep(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
274
+ T_start_C = None, T_end_C = None, dt_C = None, T_step_C = None,
275
+ P_start_bar = None, P_end_bar = None, Fe3Fet_Liq = None, Fe3Fet_init = None,
276
+ H2O_Liq = None, H2O_init = None, CO2_Liq = None, CO2_init = None,
277
+ find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None,
278
+ timeout = None, multi_processing = True, Suppress = ['rutile', 'tridymite'], Suppress_except=False,):
279
+ """
280
+ Simulates polybaric crystallization along a user-specified P-T path using the `multi_path` function.
201
281
 
202
- Returns:
282
+ Parameters
203
283
  ----------
204
- Results: Dict
205
- Dictionary where each entry represents the results of a single calculation. Within the dictionary each single calculation is reported as a series of pandas DataFrames, displaying the composition and thermodynamic properties of each phase.
206
-
207
- '''
208
- comp = bulk.copy()
284
+ Model : str, optional
285
+ Thermodynamic model, options:
286
+ MELTS:
287
+ "pMELTS"
288
+ "MELTSv1.0.2"
289
+ "MELTSv1.1.0"
290
+ "MELTSv1.2.0"
291
+ MAGEMin:
292
+ "Green2025"
293
+ "Weller2024"
294
+ bulk : dict or pandas.DataFrame
295
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
296
+ Frac_solid : bool, optional
297
+ If True, solid phases are fractionated. Default is False.
298
+ Frac_fluid : bool, optional
299
+ If True, fluid phases are fractionated. Default is False.
300
+ T_start_C, T_end_C, dt_C : float
301
+ Linear temperature path definition.
302
+ T_step_C: float
303
+ Temperature at which pressure changes.
304
+ P_start_bar, P_end_bar: float
305
+ Initial and final pressure (bars).
306
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
307
+ Initial redox and volatile content of the system.
308
+ find_liquidus : bool, optional
309
+ If True, starts at the liquidus. Default is False.
310
+ fO2_buffer : str, optional
311
+ Redox buffer (e.g., "FMQ", "NNO").
312
+ fO2_offset : float or ndarray, optional
313
+ Log unit offset from fO2 buffer.
314
+ label : str, optional
315
+ Label for the run.
316
+ Crystallinity_limit : float, optional
317
+ Stops if total crystallinity exceeds this value.
318
+ fluid_sat : bool, optional
319
+ If True, begins at fluid saturation. Default is False.
320
+ timeout : float, optional
321
+ Maximum runtime in seconds per calculation.
322
+ Suppress : list of str, optional
323
+ Phases to suppress. Default ['rutile', 'tridymite'].
324
+ Suppress_except : bool, optional
325
+ If True, suppresses all phases except those listed.
326
+ multi_processing : bool, optional
327
+ Enables multiprocessing. Default is True.
209
328
 
210
- Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_start_C = T_start_C, T_end_C = T_end_C, dt_C = dt_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout)
329
+ Returns
330
+ -------
331
+ dict
332
+ A dictionary of results with DataFrames for each phase.
333
+ """
334
+ if H2O_Liq is not None:
335
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
336
+ if H2O_init is None:
337
+ H2O_init = H2O_Liq
211
338
 
212
- return Results
339
+ if CO2_Liq is not None:
340
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
341
+ if CO2_init is None:
342
+ CO2_init = CO2_Liq
213
343
 
214
- def polybaric_crystallisation_onestep(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_start_C = None, T_end_C = None, dt_C = None, T_step_C = None, P_start_bar = None, P_end_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None):
344
+ if Fe3Fet_Liq is not None:
345
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
346
+ if Fe3Fet_init is None:
347
+ Fe3Fet_init = Fe3Fet_Liq
215
348
 
216
349
  comp = bulk.copy()
217
350
 
@@ -245,7 +378,12 @@ def polybaric_crystallisation_onestep(Model = None, bulk = None, Frac_solid = No
245
378
  P_path_bar[i,np.where(T_path_C > T_step_C[i])] = P_start_bar[i]
246
379
  P_path_bar[i,np.where(T_path_C < T_step_C[i])] = P_end_bar[i]
247
380
 
248
- Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_path_C = T_path_C, P_path_bar = P_path_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout)
381
+ Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
382
+ T_path_C = T_path_C, P_path_bar = P_path_bar, Fe3Fet_init = Fe3Fet_init,
383
+ H2O_init = H2O_init, CO2_init = CO2_init,
384
+ find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset,
385
+ label = label, timeout = timeout, Suppress = Suppress, Suppress_except=Suppress_except,
386
+ multi_processing=multi_processing)
249
387
 
250
388
  return Results
251
389
 
@@ -335,119 +473,170 @@ def polybaric_crystallisation_multistep(Model = None, bulk = None, Frac_solid =
335
473
 
336
474
  return Results
337
475
 
338
- def isothermal_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None, fluid_sat = None):
476
+ def isothermal_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
477
+ T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None,
478
+ Fe3Fet_Liq = None, Fe3Fet_init = None, H2O_Liq = None, H2O_init = None,
479
+ CO2_Liq = None, CO2_init = None, find_liquidus = None, fO2_buffer = None,
480
+ fO2_offset = None, label = None, timeout = None, fluid_sat = None,
481
+ Suppress = ['rutile', 'tridymite'], Suppress_except=False, multi_processing = True):
339
482
  """
340
- Perform isothermal decompression calculations using the provided model and input parameters.
483
+ Simulates isothermal (constant-temperature) decompression calculations using the `multi_path` function.
341
484
 
342
- This function calls the `multi_path` function to simulate decompression at constant temperature.
343
-
344
- Parameters:
345
- ----------
346
- Model : string
347
- Thermodynamic model to use (e.g., "MELTSv...", "Holland"). MELTS options are "pMELTS", "MELTSv1.0.2", "MELTSv1.1.0", and "MELTSv1.2.0".
348
- bulk : dict or pd.DataFrame
349
- Initial bulk composition for calculations. If a dictionary, the same composition is used
350
- across all steps.
351
- Frac_solid : bool
352
- Whether solid phases are fractionated at each step. Default is None.
353
- Frac_fluid : bool
354
- Whether fluid phases are fractionated at each step. Default is None.
355
- T_C : float
356
- The constant temperature (in Celsius) for the decompression.
357
- P_start_bar : float
358
- Initial pressure in bars for the decompression.
359
- P_end_bar : float
360
- Final pressure in bars for the decompression.
361
- dp_bar : float
362
- Pressure step size in bars.
363
- Fe3Fet_Liq : float
364
- Fe3+/total Fe ratio for the liquid phase.
365
- H2O_Liq : float
366
- Initial H2O content in the liquid phase.
367
- CO2_Liq : float
368
- Initial CO2 content in the liquid phase.
369
- find_liquidus : bool
370
- Whether to search for the liquidus temperature before decompression. Default is None.
371
- fO2_buffer : string
372
- Buffer for oxygen fugacity (e.g., "FMQ", "NNO"). Default is None.
373
- fO2_offset : float
374
- Offset from the oxygen fugacity buffer in log units.
375
- label : string
376
- Optional label for the calculation. Default is None.
377
- timeout : int
378
- Time limit for the calculation in seconds. Default is None.
379
- fluid_sat : bool
380
- Whether the system is fluid-saturated. Default is None.
381
-
382
- Returns:
485
+ Parameters
383
486
  ----------
384
- Results : dict
385
- Dictionary containing results of the isothermal decompression simulation, with compositions
386
- and thermodynamic properties for each step contained within phase-specific dataframes.
487
+ Model : str, optional
488
+ Thermodynamic model, options:
489
+ MELTS:
490
+ "pMELTS"
491
+ "MELTSv1.0.2"
492
+ "MELTSv1.1.0"
493
+ "MELTSv1.2.0"
494
+ MAGEMin:
495
+ "Green2025"
496
+ "Weller2024"
497
+ bulk : dict or pandas.DataFrame
498
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
499
+ Frac_solid : bool, optional
500
+ If True, solid phases are fractionated. Default is False.
501
+ Frac_fluid : bool, optional
502
+ If True, fluid phases are fractionated. Default is False.
503
+ T_C : float or ndarray
504
+ Fixed temperature for each decompression calculation.
505
+ P_start_bar, P_end_bar, dp_bar : float or ndarray
506
+ Linear pressure path definition.
507
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
508
+ Initial redox and volatile content of the system.
509
+ find_liquidus : bool, optional
510
+ If True, starts at the liquidus. Default is False.
511
+ fO2_buffer : str, optional
512
+ Redox buffer (e.g., "FMQ", "NNO").
513
+ fO2_offset : float or ndarray, optional
514
+ Log unit offset from fO2 buffer.
515
+ label : str, optional
516
+ Label for the run.
517
+ fluid_sat : bool, optional
518
+ If True, begins at fluid saturation. Default is False.
519
+ timeout : float, optional
520
+ Maximum runtime in seconds per calculation.
521
+ Suppress : list of str, optional
522
+ Phases to suppress. Default ['rutile', 'tridymite'].
523
+ Suppress_except : bool, optional
524
+ If True, suppresses all phases except those listed.
525
+ multi_processing : bool, optional
526
+ Enables multiprocessing. Default is True.
527
+
528
+ Returns
529
+ -------
530
+ dict
531
+ A dictionary of results with DataFrames for each phase.
387
532
  """
533
+ if H2O_Liq is not None:
534
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
535
+ if H2O_init is None:
536
+ H2O_init = H2O_Liq
537
+
538
+ if CO2_Liq is not None:
539
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
540
+ if CO2_init is None:
541
+ CO2_init = CO2_Liq
542
+
543
+ if Fe3Fet_Liq is not None:
544
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
545
+ if Fe3Fet_init is None:
546
+ Fe3Fet_init = Fe3Fet_Liq
547
+
388
548
  comp = bulk.copy()
389
- Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout, fluid_sat = fluid_sat)
549
+ Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
550
+ T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar,
551
+ Fe3Fet_init = Fe3Fet_init, H2O_init = H2O_init, CO2_init = CO2_init, find_liquidus = find_liquidus,
552
+ fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout,
553
+ fluid_sat = fluid_sat, Suppress = Suppress, Suppress_except=Suppress_except,
554
+ multi_processing=multi_processing)
390
555
 
391
556
  return Results
392
557
 
393
- def isentropic_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None, fluid_sat = None):
558
+ def isentropic_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None,
559
+ T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None,
560
+ Fe3Fet_Liq = None, Fe3Fet_init = None, H2O_Liq = None, H2O_init = None,
561
+ CO2_Liq = None, CO2_init = None, find_liquidus = None, fO2_buffer = None,
562
+ fO2_offset = None, label = None, timeout = None, fluid_sat = None,
563
+ Suppress = ['rutile', 'tridymite'], Suppress_except=False, multi_processing = True):
394
564
  """
395
- Perform isentropic decompression calculations using the provided model and input parameters.
396
-
397
- This function calls the `multi_path` function to simulate decompression at constant entropy.
565
+ Simulates isentropic (constant-entropy) decompression calculations using the `multi_path` function.
398
566
 
399
- Parameters:
400
- ----------
401
- Model : string
402
- Thermodynamic model to use (e.g., "MELTSv...", "Holland"). MELTS options are "pMELTS", "MELTSv1.0.2", "MELTSv1.1.0", and "MELTSv1.2.0".
403
- bulk : dict or pd.DataFrame
404
- Initial bulk composition for calculations. If a dictionary, the same composition is used
405
- across all steps.
406
- Frac_solid : bool
407
- Whether solid phases are fractionated at each step. Default is None.
408
- Frac_fluid : bool
409
- Whether fluid phases are fractionated at each step. Default is None.
410
- T_C : float
411
- The starting temperature (in Celsius) for the decompression.
412
- P_start_bar : float
413
- Initial pressure in bars for the decompression.
414
- P_end_bar : float
415
- Final pressure in bars for the decompression.
416
- dp_bar : float
417
- Pressure step size in bars.
418
- Fe3Fet_Liq : float
419
- Fe3+/total Fe ratio for the liquid phase.
420
- H2O_Liq : float
421
- Initial H2O content in the liquid phase.
422
- CO2_Liq : float
423
- Initial CO2 content in the liquid phase.
424
- find_liquidus : bool
425
- Whether to search for the liquidus temperature before decompression. Default is None.
426
- fO2_buffer : string
427
- Buffer for oxygen fugacity (e.g., "FMQ", "NNO"). Default is None.
428
- fO2_offset : float
429
- Offset from the oxygen fugacity buffer in log units.
430
- label : string
431
- Optional label for the calculation. Default is None.
432
- timeout : int
433
- Time limit for the calculation in seconds. Default is None.
434
- fluid_sat : bool
435
- Whether the system is fluid-saturated. Default is None.
436
-
437
- Returns:
567
+ Parameters
438
568
  ----------
439
- Results : dict
440
- Dictionary containing results of the isentropic decompression simulation, with compositions
441
- and thermodynamic properties for each step contained within phase-specific dataframes.
569
+ Model : str, optional
570
+ Thermodynamic model, options:
571
+ MELTS:
572
+ "pMELTS"
573
+ "MELTSv1.0.2"
574
+ "MELTSv1.1.0"
575
+ "MELTSv1.2.0"
576
+ bulk : dict or pandas.DataFrame
577
+ Initial bulk composition(s). Dictionary for a single run; DataFrame for multiple runs.
578
+ Frac_solid : bool, optional
579
+ If True, solid phases are fractionated. Default is False.
580
+ Frac_fluid : bool, optional
581
+ If True, fluid phases are fractionated. Default is False.
582
+ T_C : float or ndarray
583
+ Initial temperature for each decompression calculation.
584
+ P_start_bar, P_end_bar, dp_bar : float or ndarray
585
+ Linear pressure path definition.
586
+ Fe3Fet_init, H2O_init, CO2_init : float or ndarray, optional
587
+ Initial redox and volatile content of the system.
588
+ find_liquidus : bool, optional
589
+ If True, starts at the liquidus. Default is False.
590
+ fO2_buffer : str, optional
591
+ Redox buffer (e.g., "FMQ", "NNO").
592
+ fO2_offset : float or ndarray, optional
593
+ Log unit offset from fO2 buffer.
594
+ label : str, optional
595
+ Label for the run.
596
+ fluid_sat : bool, optional
597
+ If True, begins at fluid saturation. Default is False.
598
+ timeout : float, optional
599
+ Maximum runtime in seconds per calculation.
600
+ Suppress : list of str, optional
601
+ Phases to suppress. Default ['rutile', 'tridymite'].
602
+ Suppress_except : bool, optional
603
+ If True, suppresses all phases except those listed.
604
+ multi_processing : bool, optional
605
+ Enables multiprocessing. Default is True.
606
+
607
+ Returns
608
+ -------
609
+ dict
610
+ A dictionary of results with DataFrames for each phase.
442
611
  """
612
+ if H2O_Liq is not None:
613
+ print('Warning - the kwarg "H2O_Liq" will be removed from v1.0.0 onwards. Please use "H2O_init" instead.')
614
+ if H2O_init is None:
615
+ H2O_init = H2O_Liq
616
+
617
+ if CO2_Liq is not None:
618
+ print('Warning - the kwarg "CO2_Liq" will be removed from v1.0.0 onwards. Please use "CO2_init" instead.')
619
+ if CO2_init is None:
620
+ CO2_init = CO2_Liq
621
+
622
+ if Fe3Fet_Liq is not None:
623
+ print('Warning - the kwarg "Fe3Fet_Liq" will be removed from v1.0.0 onwards. Please use "Fe3Fet_init" instead.')
624
+ if Fe3Fet_init is None:
625
+ Fe3Fet_init = Fe3Fet_Liq
626
+
443
627
  comp = bulk.copy()
444
- Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout, isentropic = True, fluid_sat = fluid_sat)
628
+ Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid,
629
+ T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar,
630
+ Fe3Fet_init = Fe3Fet_init, H2O_init = H2O_init, CO2_init = CO2_init, find_liquidus = find_liquidus,
631
+ fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout,
632
+ isentropic = True, fluid_sat = fluid_sat, Suppress = Suppress, Suppress_except=Suppress_except,
633
+ multi_processing=multi_processing)
445
634
 
446
635
  return Results
447
636
 
448
- def isenthalpic_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None, fluid_sat = None):
637
+ # def isenthalpic_decompression(Model = None, bulk = None, Frac_solid = None, Frac_fluid = None, T_C = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Fe3Fet_Liq = None, H2O_Liq = None, CO2_Liq = None, find_liquidus = None, fO2_buffer = None, fO2_offset = None, label = None, timeout = None, fluid_sat = None):
449
638
 
450
- comp = bulk.copy()
451
- Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout, isenthalpic = True, fluid_sat = fluid_sat)
639
+ # comp = bulk.copy()
640
+ # Results = multi_path(Model = Model, bulk = comp, Frac_solid = Frac_solid, Frac_fluid = Frac_fluid, T_start_C = T_C, P_start_bar = P_start_bar, P_end_bar = P_end_bar, dp_bar = dp_bar, Fe3Fet_Liq = Fe3Fet_Liq, H2O_Liq = H2O_Liq, CO2_Liq = CO2_Liq, find_liquidus = find_liquidus, fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, label = label, timeout = timeout, isenthalpic = True, fluid_sat = fluid_sat)
452
641
 
453
- return Results
642
+ # return Results