Author Topic: Python scripts to control alphaMELTS  (Read 2394 times)

zackg@berkeley.edu

  • Newbie
  • *
  • Posts: 7
    • View Profile
Python scripts to control alphaMELTS
« on: September 17, 2014, 12:21:01 pm »
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

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #1 on: February 27, 2015, 08:54:13 am »
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

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #2 on: April 10, 2015, 11:08:40 pm »
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

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #3 on: July 19, 2015, 03:24:09 pm »
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

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #4 on: October 15, 2015, 07:39:30 am »
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

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #5 on: December 26, 2015, 06:26:29 pm »
@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

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Python scripts to control alphaMELTS
« Reply #6 on: March 17, 2020, 11:39:04 am »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 439
    • View Profile
    • My GPS Division profile
Re: Python scripts to control alphaMELTS
« Reply #7 on: March 18, 2020, 05:35:09 pm »
Thanks, Zack! Really useful, and good timing.

Best,
Paula