News:

alphaMELTS 2.3 standalone & for MATLAB/Python is now open source and available on GitHub (https://github.com/magmasource/alphaMELTS).
alphaMELTS 1.9 is available at the legacy download and information site.
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Fortran call alphamelts

Started by matrix, April 26, 2019, 07:45:11 PM

Previous topic - Next topic

matrix

Hi all,

I came up with an idea for the calculation of alphamelts as a subroutine embeded  in Fortran program. Fortran is much faster in numerical calculations (e.g., nonlinear heat conduction with layers of iterations, my case), while alphamelts is specificlly designed for (T,P,X) of rocks and it's needed in my case too, so I put alphamelts in my Fortran code. All you need is: 1. declare a character variable, e.g., cmdstr, at the begining of Fortran code; 2. add one line 'call system(cmdstr)' where needed. For example, cmdstr='E:\MELTS\run_alphamelts.command -f E:\MELTS\frac_xtal_env.txt -p E:\MELTS\test\ -b E:\MELTS\testbatch.txt', and in testbatch.txt the .melts file should be in absolute path, e.g., 'E:\MELTS\test.melts'. Just make sure all files are in absolute path.

Hope this is helpful.

Mingming


Paula

Hi Mingming,

Thanks for sharing! When the alphaMELTS 2 code is tidied up enough to go public, you'll be able to make direct calls from Fortran (similar to what alphaMELTS for MALTAB/Python does). But in the meantime, this is a neat trick that I didn't know about.

Paula

matrix

Wow, that's really cool. Hope geoscience programmers love it.


Mingming