PetThermoTools Workshop


PetThermoTools Workshop

Michael
Welcome, everyone, and thank you for signing up and responding to the workshop poll. The organizers expected around 20 responses, but more than 200 people responded, which is a fantastic turnout. The workshop itself has already helped uncover bugs and push the development forward.

Corey
The poll also helped shape the teaching plan. PetThermoTools is designed to make AlphaMELTS calculations easier, even for people who do not have much Python or MELTS experience. A little less than a quarter of respondents had some experience with MAGEMin, so MAGEMin will be included, but it will be only a small part of the practical session.

Michael
Most of the practical work will use AlphaMELTS and PetThermoTools. And because more than half of the participants had either never used Jupyter notebooks or had used them only a little, the first session includes an introduction to basic Python functions and data frames, alongside some simple MELTS calculations.

Corey
There are also several resources to keep nearby. The PetThermoTools Read the Docs site contains documentation, links to YouTube videos, example notebooks, example calculations, and other materials. The YouTube channel walks through many of those examples and adds context about what each example is intended to demonstrate.

Michael
The documentation also links to the GitHub repository, and the package has a preprint describing what the developers learned and how the code is structured. Those resources are useful if you want to go beyond the workshop exercises.

Corey
For questions during the workshop, the recommended place is Discord rather than the Zoom chat. Questions can be posted in the day-one help channel, with answers organized there or in the answer channel. That makes it easier to keep track of questions when many people are online at once.

Michael
Now let’s move to the scientific foundation. The first goal is to understand thermodynamic modeling, why it matters in igneous petrology, and how the MELTS model was developed. Petrology is complicated because natural processes can unfold across different times, depths, temperatures, pressures, and compositional reservoirs.

Corey
That means a single experiment rarely reproduces the entire natural scenario that might have formed a rock or a suite of rocks. We need a tool that combines the results of many experiments so we can test whether a proposed process could actually produce the observations. Simple phase diagrams are powerful for developing intuition, but natural systems usually contain too many components for a low-component diagram to describe everything.

Michael
So a useful petrological interpretation combines observations, experiments, and models. Empirical models can fit experimental data with equations and are often very useful when the question lies within the calibration data. But extrapolating beyond those experiments can be dangerous because the chosen functions fit the data without necessarily representing general thermodynamic behavior.

Corey
Machine learning has the same basic limitation in this context: it needs data that are directly relevant to the property being predicted. For example, if you want the distribution coefficient of iron and magnesium between liquid and olivine, measurements of unrelated liquid or olivine properties may not be enough. Thermodynamic modeling is attractive because, in principle, a general model can predict properties beyond the exact calibration set.

Michael
The MELTS family follows that strategy. It aims to construct accurate, general thermodynamic models that predict equilibrium relations and help us reason about natural igneous processes. The Holland and Powell family of models pursues a parallel goal, with a historical emphasis on metamorphic petrology, although both families can now operate below and above the solidus and can therefore be compared.

Corey
At the thermodynamic core is the idea that an equilibrium state is found by minimizing an appropriate energy function. The first and second laws lead to a relationship involving internal energy, entropy, pressure, volume, and the chemical potentials of the components. If entropy, volume, and composition are held constant, spontaneous processes lower internal energy until the system reaches a state where no spontaneous change can occur.

Michael
That statement is correct but not usually convenient experimentally, so thermodynamics defines other potentials. The most familiar is Gibbs free energy. At fixed temperature, pressure, and composition, a spontaneous process decreases Gibbs energy, and equilibrium is the configuration with the lowest Gibbs energy.

Corey
MELTS can also use other conditions. An isentropic calculation fixes entropy and minimizes enthalpy. An isochoric calculation fixes volume and minimizes Helmholtz energy, which is useful for situations such as a closed melt or fluid inclusion. The model can also exchange oxygen moles for oxygen chemical potential, or fugacity, allowing equilibrium calculations at fixed temperature, pressure, and oxygen fugacity.

Michael
The key practical idea is that a thermodynamic model fixes the bulk composition and enough independent variables to define the problem. Usually those variables include pressure and temperature, with optional constraints such as oxygen fugacity or water activity. The model then distributes the components among possible phases—such as silicate melt, vapor, minerals, and mineral solid solutions—in the way that minimizes the relevant thermodynamic potential.

Corey
The result tells you which phases are present, how much of each phase exists, the composition of each phase, and properties such as the density of the system. That is one equilibrium calculation. To represent a geological process, we repeatedly calculate equilibrium while changing pressure, temperature, or composition along a path.

Michael
For example, if temperature is lowered in steps and the solids formed at one step are removed before the next calculation, the procedure approximates perfect fractional crystallization. It is technically stepwise rather than perfectly continuous, but smaller steps approach the continuous process.

Corey
These calculations support several styles of investigation. You can construct phase diagrams, build inverse models that estimate parameters from observations, or run forward models in which you propose a process and compare the predicted results with data. Forward modeling is especially intuitive in MELTS: you can simulate decompression melting, fractional crystallization, or assimilation by repeatedly calculating equilibrium along a path.

Michael
To perform those calculations, you need three kinds of tools. First are thermodynamic models for the Gibbs energy and its derivatives for every possible phase. Second are algorithms that find the minima. Third are auxiliary functions for adding or removing phases, recognizing miscibility gaps, and bookkeeping tasks such as adding an assimilant or removing crystallized material.

Corey
You also need an interface that lets a human set up calculations and interpret the results. PetThermoTools is important because it provides a common input and output format for side-by-side calculations in the MELTS and Holland-and-Powell worlds. Previously, comparing those systems meant learning two different systems, formatting inputs twice, and interpreting two different output formats.

Michael
It is important to distinguish model versions from interface names. The original MELTS was released in 1995, but it is obsolete and is not supported by current interfaces. pMELTS, released in 2002, recalibrated the liquid model for high-pressure mantle melting, especially around one to three gigapascals.

Corey
There is also pHMELTS, which uses a method for calculations involving very small amounts of water, such as water released from nominally anhydrous mantle minerals. Rhyolite-MELTS appeared in 2012 and superseded the original MELTS model. Later, work on mixed water-CO2 vapor and CO2 dissolved in silicate liquid led to Rhyolite-MELTS 1.1 and 1.2.

Michael
Choosing among these versions depends on the problem. For peridotite or pyroxenite mantle melting between one and three gigapascals, pMELTS is the appropriate choice. For natural magma crystallization between zero and two gigapascals, a MELTS model may be appropriate, but MELTS is not intended for highly simplified ceramic-like systems or calculations at ten gigapascals.

Corey
If there is no fluid and no dissolved water or CO2, Rhyolite-MELTS 1.0 can be used. For quartz-saturated magmas evolving toward the fluid-saturated granite minimum, Rhyolite-MELTS 1.1 is the choice. For other CO2-bearing systems, including basaltic and alkaline systems, Rhyolite-MELTS 1.2 is generally preferred.

Michael
The reason pMELTS exists is that the original model showed systematic errors at high pressure. Additional high-pressure experiments and changes to the equations of state improved predictions for peridotite melting. However, pMELTS is not automatically better everywhere: the assumptions that improve high-pressure behavior can make it worse at low pressure, so MELTS and pMELTS remain parallel models for different pressure ranges.

Corey
Rhyolite-MELTS addressed another issue: the original calibration contained too few quartz-saturated experiments. In simulations of the Bishop Tuff, the older model spread crystallization over roughly a hundred degrees and did not reproduce the narrow, wet-granite-minimum behavior seen in the natural system. Adjusting the standard-state properties of quartz and sanidine produced a much narrower crystallization interval.

Michael
If quartz saturation is not involved, MELTS and Rhyolite-MELTS are identical for that issue. If quartz saturation is involved, the original MELTS behavior is wrong and Rhyolite-MELTS should be used. Later work improved predictions for water and CO2 in mixed vapor systems, but the changes that improved degassing behavior created the distinction between Rhyolite-MELTS 1.1 and 1.2.

Corey
The models contain libraries of possible minerals and other phases. These include silicate melt, vapor, pure solids, mineral solid solutions, and, under very reducing conditions, iron-nickel alloy. Solid-solution groups include pyroxenes, olivines, garnets, feldspars, biotite, spinels, rhombohedral oxides, and simplified amphiboles.

Michael
The details of those solid solutions matter. Spinel, for example, can represent compositions ranging from ordinary spinel through hercynite, chrome spinel, magnetite, and ulvospinel. The rhombohedral oxide phase includes ilmenite-related compositions and is used with spinel in calculations involving oxide equilibria.

Corey
But the mineral models are not complete descriptions of every natural mineral. Pyroxenes, garnets, micas, and especially amphiboles lack some important components. Amphibole is a major limitation because natural amphiboles contain vacancies, manganese, titanium, fluorine, and other non-ideal features. Those minor components increase entropy and lower Gibbs energy, making real amphibole more stable than a simple model may predict.

Michael
Solid-solution models describe crystal sites, which ions can occupy those sites, the compositional range, and how ions are distributed among sites. In pyroxenes, components such as diopside, hedenbergite, enstatite, and jadeite are used, along with special components that represent combinations of ferric iron, aluminum, and titanium.

Corey
That representation creates a practical warning. In a simplified system where one of those elements is exactly absent, two component amounts may need to cancel numerically. Tiny computer roundoff errors can leave a slightly negative amount, and taking its logarithm can crash the calculation. Since MELTS is designed for natural systems, it is generally better to include small nonzero amounts of aluminum, ferric iron, and titanium rather than setting them exactly to zero.

Michael
The heart of MELTS is both its solid-solution models and its treatment of mixing in silicate liquid. Because liquid structures are too complicated and time-dependent for a completely accurate general model, MELTS approximates the liquid as a mixture of simple, mineral-like molecules. For example, magnesium is represented as if it moved among molecules such as forsterite or picrochromite, while ferrous iron is represented through fayalite-like molecules.

Corey
That molecular picture is an approximation, but decades of experience show that it can make meaningful predictions. The excess mixing parameters are calibrated against large collections of experiments in which solids and liquids coexist at equilibrium. When CO2 was incorporated, the model needed both a CO2 molecule and a carbonate group so it could represent carbon behavior from rhyolitic to basaltic systems.

Michael
Under the hood, an equilibrium calculation begins with an initial guess. A superliquidus guess assumes the system is entirely liquid and that the liquid composition equals the bulk composition. That is usually a valid starting point, but it can be inefficient for subsolidus conditions, so AlphaMELTS can also use a subsolidus guess that distributes the components among solids.

Corey
After the initial guess, the algorithm checks whether additional phases should be added. It minimizes the chosen thermodynamic potential for the current assemblage, checks whether any phases are disappearing and should be removed, and checks whether a phase wants to split into multiple compositions. If a phase needs to be added, removed, or split, the calculation loops until the assemblage is stable.

Michael
Once no more phases need to be added, removed, or split, the model has found equilibrium. That state can be returned to the interface, saved, graphed, and used as the initial guess for the next step along a pressure-temperature-composition path. This is how one equilibrium calculation becomes a simulation of a larger geological process.

Corey
The strengths are substantial. Thermodynamic models can be accurate, test many hypotheses, track many properties, and simulate complex processes. Because they are constructed generally rather than fitted only to one particular data set, they can also produce surprising predictions, such as Rhyolite-MELTS 1.2 predicting carbonatites even though it was not trained specifically to do so.

Michael
The limitations are just as important. Models can be inaccurate, and it is not always obvious in advance when they will fail. Minor components may be handled imperfectly, some phases are too simple to reproduce nature, and the calculations may still be too slow for applications requiring millions or billions of runs.

Corey
And sometimes the model crashes or refuses to converge. That is the ugly part, but a failed calculation is not necessarily the end of the investigation. There are often workarounds for crashes and convergence problems, and one of the practical lessons of the workshop is to use those strategies rather than giving up after the first failure.

Michael
So the overall picture is this: MELTS and PetThermoTools combine thermodynamic theory, experimental calibration, phase models, numerical minimization, and practical interfaces. They let us move from observations and experiments to testable simulations of igneous processes, while reminding us to choose the appropriate model version, understand the phase-model limitations, and treat convergence and accuracy as scientific issues rather than merely technical details.

Ask anything
We've read this whole study set, so questions about it get the best answers.