News:

alphaMELTS 1.9 is available at the download and information site.
alphaMELTS 2 standalone & for MATLAB/Python are available on request
(see the Version 2 tab on the download site for more details).
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Python scripts to control alphaMELTS

Started by zackg@berkeley.edu, September 17, 2014, 12:21:01 PM

Previous topic - Next topic

zackg@berkeley.edu

I've been using Python and terminal on OS X to run alphaMELTS.  The Python scripts will generate alphaMELTS input files, then use Gnu Parallels to run batches of alphaMELTS overnight, and then tear apart the output files and make plots.  For example, I do a Monte Carlo of 10000 MELTS computations with slightly different bulk compositions to see what influence the uncertainty in my bulk composition has on the predicted phases, and other similar tasks.

If anyone is interested, feel free to ping me.  If anyone else is using python to drive their MELTS workflow, I'd be interested in your scripts as well.

Zack Gainsforth
zackg at berkeley.edu

SladeBeta

So, I have recently been doing something similar. My Father in Law (who is a software engineer) and I wrote a python script to run through multiple iterations of alphaMELTS, too. Ours is keeping the same composition, and running through multiple variations of the conditions (fO2, Pressure, Temperature, H20 content, etc). We were thinking about making a script as well to pull apart the files and pull out the information that need. Did you use GNU plot for the plots, or something else? I was looking at using awk for the filtering, or python (although python would require more scripting).

I'm curious what method you used to pull everything apart and plot it and if that worked well for you.

Stephen Potter

zackg@berkeley.edu

I used Python front to back, more or less.

1) Python writes the .melts files into as many directories as needed to span the simulation space.

2) I used GNU parallel to spawn alphamelts processes (4 at a time since I have 4 cores).

3) Then Python tears apart the output files using regex.  I came up with expressions that grabbed the phases I was interested in and extracted those into numpy tables.

4) Then I plotted those tables using matplotlib.

If you give me your e-mail address, I can e-mail you source code.  I was thinking maybe I should put it up on github too though it is pretty unpolished (the main reason why I haven't...)

You could, of course, use awk and gnuplot if you like.  I simply used the approaches built into scientific python because I found them very handy and was familiar with them.

Zack

jhaddad1

Thanks for sharing, I am putting together a python script to parse the MELTs outputs into a format that I can put straight into R, I then use R to make my plots. I would love to see more of what you guys are doing and am happy to share the little bit that I've done so far.

scotthull

I'm in the process of writing Python code like this at the moment...

Might you be able to tell me exactly how you got Python to pass commands to alphaMELTS?  I can get alphaMELTS to boot but further communication is proving to be difficult...

jhaddad1

@ScottHull I think I tried to PM you, but you can email me jhaddad1@binghamton.edu and I can share what I did with you in more detail.

zackg@berkeley.edu

Hi,

I've been seeing some continued interest in this and the code has continued to evolve as I use it for various projects.  Therefore, I have made it available on Github and recorded a youtube video that briefly introduces how to use it.  For someone savvy with python they should be able to get started pretty quickly.

https://github.com/ZGainsforth/alphaMELTSEnsemble

https://www.youtube.com/watch?v=AyIksocsp4M&t=810s

And as usual you can always ping me with questions.

Zack Gainsforth
zackg@berkeley.edu

Paula

Thanks, Zack! Really useful, and good timing.

Best,
Paula