Skip to content

Commit

Permalink
MAGEMin v1.6.0
Browse files Browse the repository at this point in the history
- Added extended metapelite database to account for CO2 and S
- Added option to select combination of solution phase for metapelite and metabasite database
- Added “light” option to save minimum output from MAGEMin_C calculations
- Added several pseudocompounds for metapelite to improve phase diagrams quality 
- Corrected mistake when saving endmember wt fraction and end member wt composition
  • Loading branch information
NicolasRiel authored Nov 28, 2024
2 parents e04e939 + d059167 commit e2ec98a
Show file tree
Hide file tree
Showing 34 changed files with 38,447 additions and 568 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ SOURCES=src/MAGEMin.c \
src/TC_database/SS_xeos_PC_igad.c \
src/TC_database/SS_xeos_PC_um.c \
src/TC_database/SS_xeos_PC_mtl.c \
src/TC_database/SS_xeos_PC_mpe.c \
src/SB_database/SS_xeos_PC_sb11.c \
src/pp_min_function.c \
src/ss_min_function.c \
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MAGEMin_C"
uuid = "e5d170eb-415a-4524-987b-12f1bce1ddab"
authors = ["Boris Kaus <[email protected]> & Nicolas Riel <[email protected]>"]
version = "1.5.9"
version = "1.6.0"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand Down
2 changes: 1 addition & 1 deletion doc_raw/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

|
**MAGEMin v1.5.9**
**MAGEMin v1.6.0**
==================

MAGEMin (Mineral Assemblage Gibbs Energy Minimization) is a parallel C library callable from any petrological/geodynamic tool. For a given set of pressure, temperature and bulk-rock composition MAGEMin uses a combination of linear programming, extended Partitioning Gibbs free Energy and gradient-based local minimization to compute the most stable mineral assemblage
Expand Down
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MAGEMin v1.5.9 &mdash; MAGEMin 2022 documentation</title>
<title>MAGEMin v1.6.0 &mdash; MAGEMin 2022 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
Expand Down Expand Up @@ -247,7 +247,7 @@
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home"></a> &raquo;</li>
<li><strong>MAGEMin v1.5.9</strong></li>
<li><strong>MAGEMin v1.6.0</strong></li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
Expand All @@ -263,7 +263,7 @@
<div class="line"><br /></div>
</div>
<section id="magemin-v1-5-0">
<h1><strong>MAGEMin v1.5.9</strong><a class="headerlink" href="#magemin-v1-5-0" title="Permalink to this headline"></a></h1>
<h1><strong>MAGEMin v1.6.0</strong><a class="headerlink" href="#magemin-v1-5-0" title="Permalink to this headline"></a></h1>
<p>MAGEMin (Mineral Assemblage Gibbs Energy Minimization) is a parallel C library callable from any petrological/geodynamic tool. For a given set of pressure, temperature and bulk-rock composition MAGEMin uses a combination of linear programming, extended Partitioning Gibbs free Energy and gradient-based local minimization to compute the most stable mineral assemblage</p>
<p>A full description of the minimization approach used in MAGEMin is given in:</p>
<p>Riel, N., Kaus, B. J. P., Green, E. C. R., &amp; Berlie, N. (2022). MAGEMin, an efficient Gibbs energy minimizer: Application to igneous systems. Geochemistry, Geophysics, Geosystems, 23, e2022GC010427. <a class="reference external" href="https://doi.org/10.1029/2022GC010427">https://doi.org/10.1029/2022GC010427</a></p>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/stp.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="External libraries" href="stp/Linux.html" />
<link rel="prev" title="MAGEMin v1.5.9" href="index.html" />
<link rel="prev" title="MAGEMin v1.6.0" href="index.html" />
</head>

<body class="wy-body-for-nav">
Expand Down Expand Up @@ -292,7 +292,7 @@ <h1>Optional (developers)<a class="headerlink" href="#optional-developers" title
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="MAGEMin v1.5.9" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="index.html" class="btn btn-neutral float-left" title="MAGEMin v1.6.0" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="stp/Linux.html" class="btn btn-neutral float-right" title="External libraries" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

Expand Down
171 changes: 159 additions & 12 deletions gen/magemin_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,9 @@ mutable struct global_variables
limitCaOpx::Cint
CaOpxLim::Cdouble
mbCpx::Cint
mbIlm::Cint
mpSp::Cint
mpIlm::Cint
fluidSpec::Cint
n_fs_db::Cint
test::Cint
Expand Down Expand Up @@ -658,6 +661,7 @@ mutable struct global_variables
numPoint::Cint
global_ite::Cint
H2O_id::Cint
CO2_id::Cint
S_id::Cint
Al2O3_id::Cint
CaO_id::Cint
Expand Down Expand Up @@ -1188,6 +1192,7 @@ struct stb_systems
ph_frac_vol::Ptr{Cdouble}
ph_type::Ptr{Cint}
ph_id::Ptr{Cint}
ph_id_db::Ptr{Cint}
SS::Ptr{stb_SS_phase}
mSS::Ptr{mstb_SS_phase}
PP::Ptr{stb_PP_phase}
Expand Down Expand Up @@ -1319,10 +1324,10 @@ mutable struct metapelite_datasets
n_ss::Cint
ox::NTuple{11, NTuple{20, Cchar}}
PP::NTuple{23, NTuple{20, Cchar}}
SS::NTuple{16, NTuple{20, Cchar}}
verifyPC::NTuple{16, Cint}
n_SS_PC::NTuple{16, Cint}
SS_PC_stp::NTuple{16, Cdouble}
SS::NTuple{18, NTuple{20, Cchar}}
verifyPC::NTuple{18, Cint}
n_SS_PC::NTuple{18, Cint}
SS_PC_stp::NTuple{18, Cdouble}
PC_df_add::Cdouble
solver_switch_T::Cdouble
min_melt_T::Cdouble
Expand All @@ -1345,14 +1350,10 @@ mutable struct metabasite_datasets
n_ss::Cint
ox::NTuple{10, NTuple{20, Cchar}}
PP::NTuple{23, NTuple{20, Cchar}}
SS1::NTuple{15, NTuple{20, Cchar}}
verifyPC1::NTuple{15, Cint}
n_SS_PC1::NTuple{15, Cint}
SS_PC_stp1::NTuple{15, Cdouble}
SS2::NTuple{15, NTuple{20, Cchar}}
verifyPC2::NTuple{15, Cint}
n_SS_PC2::NTuple{15, Cint}
SS_PC_stp2::NTuple{15, Cdouble}
SS::NTuple{17, NTuple{20, Cchar}}
verifyPC::NTuple{17, Cint}
n_SS_PC::NTuple{17, Cint}
SS_PC_stp::NTuple{17, Cdouble}
PC_df_add::Cdouble
solver_switch_T::Cdouble
min_melt_T::Cdouble
Expand Down Expand Up @@ -1498,6 +1499,32 @@ end

const mantle_dataset = mantle_datasets

mutable struct metapelite_datasets_ext
ds_version::Cint
n_ox::Cint
n_pp::Cint
n_ss::Cint
ox::NTuple{13, NTuple{20, Cchar}}
PP::NTuple{25, NTuple{20, Cchar}}
SS::NTuple{23, NTuple{20, Cchar}}
verifyPC::NTuple{23, Cint}
n_SS_PC::NTuple{23, Cint}
SS_PC_stp::NTuple{23, Cdouble}
PC_df_add::Cdouble
solver_switch_T::Cdouble
min_melt_T::Cdouble
inner_PGE_ite::Cdouble
max_n_phase::Cdouble
max_g_phase::Cdouble
max_fac::Cdouble
merge_value::Cdouble
re_in_n::Cdouble
obj_tol::Cdouble
metapelite_datasets_ext() = new()
end

const metapelite_dataset_ext = metapelite_datasets_ext

function global_variable_TC_init(gv, z_b)
ccall((:global_variable_TC_init, libMAGEMin), global_variable, (global_variable, Ptr{bulk_info}), gv, z_b)
end
Expand All @@ -1514,6 +1541,10 @@ function get_bulk_mantle(gv)
ccall((:get_bulk_mantle, libMAGEMin), global_variable, (global_variable,), gv)
end

function get_bulk_metapelite_ext(gv)
ccall((:get_bulk_metapelite_ext, libMAGEMin), global_variable, (global_variable,), gv)
end

mutable struct stx11_datasets
ds_version::Cint
n_ox::Cint
Expand Down Expand Up @@ -1654,6 +1685,10 @@ function TC_SS_init_um_ext(SS_init, gv)
ccall((:TC_SS_init_um_ext, libMAGEMin), Cvoid, (Ptr{SS_init_type}, global_variable), SS_init, gv)
end

function TC_SS_init_mp_ext(SS_init, gv)
ccall((:TC_SS_init_mp_ext, libMAGEMin), Cvoid, (Ptr{SS_init_type}, global_variable), SS_init, gv)
end

function TC_SS_init_mtl(SS_init, gv)
ccall((:TC_SS_init_mtl, libMAGEMin), Cvoid, (Ptr{SS_init_type}, global_variable), SS_init, gv)
end
Expand Down Expand Up @@ -1690,6 +1725,10 @@ function G_SS_mtl_EM_function(gv, SS_ref_db, EM_dataset, z_b, name)
ccall((:G_SS_mtl_EM_function, libMAGEMin), SS_ref, (global_variable, SS_ref, Cint, bulk_info, Ptr{Cchar}), gv, SS_ref_db, EM_dataset, z_b, name)
end

function G_SS_mpe_EM_function(gv, SS_ref_db, EM_dataset, z_b, name)
ccall((:G_SS_mpe_EM_function, libMAGEMin), SS_ref, (global_variable, SS_ref, Cint, bulk_info, Ptr{Cchar}), gv, SS_ref_db, EM_dataset, z_b, name)
end

function TC_mb_objective_init_function(SS_objective, gv)
ccall((:TC_mb_objective_init_function, libMAGEMin), Cvoid, (Ptr{obj_type}, global_variable), SS_objective, gv)
end
Expand Down Expand Up @@ -1718,6 +1757,10 @@ function TC_mtl_objective_init_function(SS_objective, gv)
ccall((:TC_mtl_objective_init_function, libMAGEMin), Cvoid, (Ptr{obj_type}, global_variable), SS_objective, gv)
end

function TC_mpe_objective_init_function(SS_objective, gv)
ccall((:TC_mpe_objective_init_function, libMAGEMin), Cvoid, (Ptr{obj_type}, global_variable), SS_objective, gv)
end

function TC_SS_objective_init_function(SS_objective, gv)
ccall((:TC_SS_objective_init_function, libMAGEMin), Cvoid, (Ptr{obj_type}, global_variable), SS_objective, gv)
end
Expand Down Expand Up @@ -2097,6 +2140,98 @@ function obj_mtl_hpx(n, x, grad, SS_ref_db)
ccall((:obj_mtl_hpx, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_liq(n, x, grad, SS_ref_db)
ccall((:obj_mpe_liq, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_fsp(n, x, grad, SS_ref_db)
ccall((:obj_mpe_fsp, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_bi(n, x, grad, SS_ref_db)
ccall((:obj_mpe_bi, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_g(n, x, grad, SS_ref_db)
ccall((:obj_mpe_g, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_ep(n, x, grad, SS_ref_db)
ccall((:obj_mpe_ep, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_ma(n, x, grad, SS_ref_db)
ccall((:obj_mpe_ma, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_mu(n, x, grad, SS_ref_db)
ccall((:obj_mpe_mu, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_opx(n, x, grad, SS_ref_db)
ccall((:obj_mpe_opx, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_sa(n, x, grad, SS_ref_db)
ccall((:obj_mpe_sa, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_cd(n, x, grad, SS_ref_db)
ccall((:obj_mpe_cd, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_st(n, x, grad, SS_ref_db)
ccall((:obj_mpe_st, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_chl(n, x, grad, SS_ref_db)
ccall((:obj_mpe_chl, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_ctd(n, x, grad, SS_ref_db)
ccall((:obj_mpe_ctd, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_sp(n, x, grad, SS_ref_db)
ccall((:obj_mpe_sp, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_ilm(n, x, grad, SS_ref_db)
ccall((:obj_mpe_ilm, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_ilmm(n, x, grad, SS_ref_db)
ccall((:obj_mpe_ilmm, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_mt(n, x, grad, SS_ref_db)
ccall((:obj_mpe_mt, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_fl(n, x, grad, SS_ref_db)
ccall((:obj_mpe_fl, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_occm(n, x, grad, SS_ref_db)
ccall((:obj_mpe_occm, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_dio(n, x, grad, SS_ref_db)
ccall((:obj_mpe_dio, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_aug(n, x, grad, SS_ref_db)
ccall((:obj_mpe_aug, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_hb(n, x, grad, SS_ref_db)
ccall((:obj_mpe_hb, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_mpe_po(n, x, grad, SS_ref_db)
ccall((:obj_mpe_po, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end

function obj_aq17(n, x, grad, SS_ref_db)
ccall((:obj_aq17, libMAGEMin), Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Cvoid}), n, x, grad, SS_ref_db)
end
Expand Down Expand Up @@ -2133,6 +2268,10 @@ function TC_mtl_PC_init(PC_read, gv)
ccall((:TC_mtl_PC_init, libMAGEMin), Cvoid, (Ptr{PC_type}, global_variable), PC_read, gv)
end

function TC_mpe_PC_init(PC_read, gv)
ccall((:TC_mpe_PC_init, libMAGEMin), Cvoid, (Ptr{PC_type}, global_variable), PC_read, gv)
end

# typedef SS_ref ( * NLopt_type ) ( global_variable gv , SS_ref SS_ref_db )
const NLopt_type = Ptr{Cvoid}

Expand Down Expand Up @@ -2168,6 +2307,10 @@ function TC_NLopt_opt_init(NLopt_opt, gv)
ccall((:TC_NLopt_opt_init, libMAGEMin), Cvoid, (Ptr{NLopt_type}, global_variable), NLopt_opt, gv)
end

function TC_mpe_NLopt_opt_init(NLopt_opt, gv)
ccall((:TC_mpe_NLopt_opt_init, libMAGEMin), Cvoid, (Ptr{NLopt_type}, global_variable), NLopt_opt, gv)
end

function NLopt_opt_ig_spn_function(gv, SS_ref_db)
ccall((:NLopt_opt_ig_spn_function, libMAGEMin), SS_ref, (global_variable, SS_ref), gv, SS_ref_db)
end
Expand Down Expand Up @@ -2204,6 +2347,10 @@ function SS_mtl_pc_init_function(SS_pc_xeos, iss, name)
ccall((:SS_mtl_pc_init_function, libMAGEMin), Cvoid, (Ptr{PC_ref}, Cint, Ptr{Cchar}), SS_pc_xeos, iss, name)
end

function SS_mpe_pc_init_function(SS_pc_xeos, iss, name)
ccall((:SS_mpe_pc_init_function, libMAGEMin), Cvoid, (Ptr{PC_ref}, Cint, Ptr{Cchar}), SS_pc_xeos, iss, name)
end

function SB_SS_init(SS_init, gv)
ccall((:SB_SS_init, libMAGEMin), Cvoid, (Ptr{SS_init_type}, global_variable), SS_init, gv)
end
Expand Down
Loading

0 comments on commit e2ec98a

Please sign in to comment.