MELTS Software Users

MELTS for Excel, rhyolite-MELTS (GUI) and alphaMELTS => Interactive operation => General usage => Topic started by: Freewill on July 29, 2024, 01:08:44 AM

Title: How to parse the output and transfer the chemical formulas of mineral phases
Post by: Freewill on July 29, 2024, 01:08:44 AM
Hi all,

I have trouble to deal with the raw output of alphaMelts (pMelts), which is tricky for me to be format and reorganize to an easy-to-use form such as a Excel datasheet.

To be specific, are there methods to

1. parse the chemical formula for the given P-T values, out of the output text file (Phase_main.tbl.txt), e.g., extract all the strings of the chemical formulas of each minerals (olivine, garnet, orthopyroxene, clinopyroxene, spinel, whitlockite), and neglect other information such as the oxide contents.

The raw data in Phase_main.tbl.txt is in the following form:
...
Pressure 10000.00 Temperature 1200.00 SiO2 TiO2 Al2O3 Fe2O3 Cr2O3 FeO MnO MgO NiO CaO Na2O K2O P2O5
olivine_0 57.805364 140.410297 -722473.178253 17.842285 72.833618 (Ca0.00Mg0.88Fe''0.11Mn0.00Co0.00Ni0.00)2SiO4 40.5462 0 0 0 0 10.6843 0.224893 47.8622 0.432486 0.249936 0 0 0
garnet_0 2.712072  6.516688 -36755.703009 0.769388 3.434173 (Ca0.00Fe''0.07Mg0.93)3Al2Si3O12 43.9718 0 24.8729 0 0 3.67999 0 27.3205 0 0.154776 0 0 0
orthopyroxene_0 24.655684 60.296146 -323061.983652 7.768338 32.002617 opx Na0.00Ca0.03Fe''0.14Mg1.79Fe'''0.01Ti0.01Al0.06Si1.96O6 57.2369 0.250956 1.4204 0.20259 0 4.99485 0 35.0577 0 0.804751 0.0318615 0 0
clinopyroxene_0 5.074600 11.991060 -65352.839099 1.585695 6.143241 cpx Na0.02Ca0.72Fe''0.11Mg1.08Fe'''0.01Ti0.01Al0.11Si1.94O6 53.857 0.406436 2.70987 0.328105 0 3.64023 0 20.0963 0 18.6616 0.300501 0 0
feldspar_0 7.885415 19.373262 -105822.290493 2.937619 9.700931 K0.01Na0.31Ca0.68Al1.68Si2.32O8 51.036 0 31.3326 0 0 0 0 0 0 13.9411 3.53818 0.15218 0
spinel_0 1.555376  3.359520 -13718.697509 0.365344 1.661910 Fe''0.37Mg0.67Fe'''0.07Al0.80Cr1.05Ti0.04O4 0 1.76806 22.3098 2.85461 43.7193 14.65 0 14.6981 0 0 0 0 0
whitlockite 0.030593  0.073791 -354.133757 0.009628 0.032521 Ca3(PO4)2
...


and the following is what I expect:
Pressure: 10000.00
Temperature: 1200.00
olivine_0: (Ca0.00Mg0.88Fe''0.11Mn0.00Co0.00Ni0.00)2SiO4
garnet_0: (Ca0.00Fe''0.07Mg0.93)3Al2Si3O12
orthopyroxene_0: Na0.00Ca0.03Fe''0.14Mg1.79Fe'''0.01Ti0.01Al0.06Si1.96O6
clinopyroxene_0: Na0.02Ca0.72Fe''0.11Mg1.08Fe'''0.01Ti0.01Al0.11Si1.94O6
feldspar_0: K0.01Na0.31Ca0.68Al1.68Si2.32O8
spinel_0: Fe''0.37Mg0.67Fe'''0.07Al0.80Cr1.05Ti0.04O4
whitlockite: Ca3(PO4)2



2. simplify the chemical formula of each mineral and transfer it into a form with combination of its end-member minerals
For example, for the chemical formula of olivine_0 above, the following is what the transition I want:
(Ca0.00Mg0.88Fe''0.11Mn0.00Co0.00Ni0.00)2SiO4 ==> 0.88 * Mg2SiO4 (Forsterite) + 0.11 * Fe2SiO4 (Fayalite)


Best regards,
Qingwen
Title: Re: How to parse the output and transfer the chemical formulas of mineral phases
Post by: Paula on July 29, 2024, 04:50:52 PM
Is this alphaMELTS 1.9 output? If so, you can use column_pick.command to select the table columns with the chemical formulas. There is lots of information about this in the documentation. But run_alphamelts.command needs to process the Phase_main_tbl.txt file first. That should happen automatically when you exit the alphaMELTS menu prompt, but what you've posted is not processed.

Assuming you have Perl installed (on Windows) or are on a Mac or Linux, which come with Perl, then the possible reasons for the failure include:

Depending what you are trying to do, alphaMELTS for MATLAB/Python, easyMelts or standalone alphaMELTS 2 may make processing the output in the way you need simpler:


Title: Re: How to parse the output and transfer the chemical formulas of mineral phases
Post by: Freewill on July 29, 2024, 11:14:03 PM
Hi Paula,

Thanks for your replying.

I did run alphaMELTS 1.9 (on Windows 10) by running the Perl script run_alphamelts.command (Perl was installed beforehand) and Phase_main_tbl.txt is one of the output.

I will try different ways of using alphaMELTS as you mentioned.

Best,
Qingwen