Skip to content

Commit

Permalink
MAGEMin v1.5.9
Browse files Browse the repository at this point in the history
- Corrected default ilmenite model for metapelite and metabasite database to be ilm instead of ilmm
- Added adaptive refinement for MAGEMin_C Julia wrapper
  • Loading branch information
NicolasRiel authored Nov 25, 2024
2 parents 6c625b4 + 110094d commit e04e939
Show file tree
Hide file tree
Showing 57 changed files with 7,383 additions and 700 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ SOURCES=src/MAGEMin.c \
src/SB_database/sb_gss_init_function.c \
src/SB_database/sb_gss_function.c \
src/TC_database/NLopt_opt_function.c \
src/SB_database/SB_NLopt_opt_function.c \
src/TC_database/objective_functions.c \
src/SB_database/sb_objective_functions.c\
src/TC_database/SS_xeos_PC_mp.c \
src/TC_database/SS_xeos_PC_mb.c \
src/TC_database/SS_xeos_PC_ig.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/SB_database/SS_xeos_PC_sb11.c \
src/pp_min_function.c \
src/ss_min_function.c \
src/simplex_levelling.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.8"
version = "1.5.9"

[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.8**
**MAGEMin v1.5.9**
==================

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.8 &mdash; MAGEMin 2022 documentation</title>
<title>MAGEMin v1.5.9 &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.8</strong></li>
<li><strong>MAGEMin v1.5.9</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.8</strong><a class="headerlink" href="#magemin-v1-5-0" title="Permalink to this headline"></a></h1>
<h1><strong>MAGEMin v1.5.9</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.8" href="index.html" />
<link rel="prev" title="MAGEMin v1.5.9" 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.8" 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.5.9" 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
118 changes: 105 additions & 13 deletions gen/magemin_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ struct PP_refs
factor_norm::Cdouble
phase_density::Cdouble
phase_shearModulus::Cdouble
phase_shearModulus_v::Cdouble
phase_bulkModulus::Cdouble
phase_cp::Cdouble
phase_expansivity::Cdouble
phase_isoTbulkModulus::Cdouble
volume_P0::Cdouble
thetaExp::Cdouble
phase_entropy::Cdouble
phase_enthalpy::Cdouble
phase_bulkModulus::Cdouble
volume::Cdouble
mass::Cdouble
charge::Cdouble
Expand Down Expand Up @@ -865,6 +863,11 @@ struct SS_refs
mu_Ppc::Ptr{Ptr{Cdouble}}
xeos_Ppc::Ptr{Ptr{Cdouble}}
solvus_id::Ptr{Cint}
n_cat::Cint
C::Ptr{Ptr{Cdouble}}
N::Ptr{Ptr{Cdouble}}
Vec1::Ptr{Cdouble}
Vec2::Ptr{Cdouble}
is_liq::Cint
symmetry::Cint
n_em::Cint
Expand Down Expand Up @@ -915,6 +918,7 @@ struct SS_refs
sum_xi::Cdouble
xeos::Ptr{Cdouble}
ElShearMod::Ptr{Cdouble}
ElBulkMod::Ptr{Cdouble}
density::Ptr{Cdouble}
phase_density::Cdouble
volume::Cdouble
Expand Down Expand Up @@ -1028,10 +1032,8 @@ struct csd_phase_sets
phase_expansivity::Cdouble
phase_bulkModulus::Cdouble
phase_isoTbulkModulus::Cdouble
volume_P0::Cdouble
thetaExp::Cdouble
phase_shearModulus::Cdouble
phase_shearModulus_v::Cdouble
phase_entropy::Cdouble
phase_enthalpy::Cdouble
end
Expand Down Expand Up @@ -1257,6 +1259,10 @@ function ReadCommandLineOptions(gv, z_b, argc, argv)
ccall((:ReadCommandLineOptions, libMAGEMin), global_variable, (global_variable, Ptr{bulk_info}, Cint, Ptr{Ptr{Cchar}}), gv, z_b, argc, argv)
end

function SetupDatabase(gv, z_b)
ccall((:SetupDatabase, libMAGEMin), global_variable, (global_variable, Ptr{bulk_info}), gv, z_b)
end

function PrintOutput(gv, rank, l, DB, time_taken, z_b)
ccall((:PrintOutput, libMAGEMin), Cvoid, (global_variable, Cint, Cint, Databases, Cdouble, bulk_info), gv, rank, l, DB, time_taken, z_b)
end
Expand Down Expand Up @@ -1514,7 +1520,7 @@ mutable struct stx11_datasets
n_pp::Cint
n_ss::Cint
ox::NTuple{6, NTuple{20, Cchar}}
PP::NTuple{9, NTuple{20, Cchar}}
PP::NTuple{10, NTuple{20, Cchar}}
SS::NTuple{14, NTuple{20, Cchar}}
verifyPC::NTuple{14, Cint}
n_SS_PC::NTuple{14, Cint}
Expand Down Expand Up @@ -1560,6 +1566,7 @@ end
mutable struct em_datas
C::NTuple{14, Cdouble}
ElShearMod::Cdouble
ElBulkMod::Cdouble
gb::Cdouble
charge::Cdouble
em_datas() = new()
Expand Down Expand Up @@ -2126,13 +2133,6 @@ function TC_mtl_PC_init(PC_read, gv)
ccall((:TC_mtl_PC_init, libMAGEMin), Cvoid, (Ptr{PC_type}, global_variable), PC_read, gv)
end

# typedef void ( * sf_type ) ( unsigned m , double * result , unsigned n , const double * x , double * grad , void * data )
const sf_type = Ptr{Cvoid}

function NLopt_global_opt_function(z_b, gv, PP_ref_db, SS_ref_db, cp)
ccall((:NLopt_global_opt_function, libMAGEMin), global_variable, (bulk_info, global_variable, Ptr{PP_ref}, Ptr{SS_ref}, Ptr{csd_phase_set}), z_b, gv, PP_ref_db, SS_ref_db, cp)
end

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

Expand Down Expand Up @@ -2212,6 +2212,90 @@ function G_SS_sb11_EM_function(gv, SS_ref_db, EM_dataset, z_b, name)
ccall((:G_SS_sb11_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 SB_sb11_objective_init_function(SS_objective, gv)
ccall((:SB_sb11_objective_init_function, libMAGEMin), Cvoid, (Ptr{obj_type}, global_variable), SS_objective, gv)
end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

function SB_PC__function(gv, PC_read, SS_ref_db, z_b, ph_id)
ccall((:SB_PC__function, libMAGEMin), SS_ref, (global_variable, Ptr{PC_type}, SS_ref, bulk_info, Cint), gv, PC_read, SS_ref_db, z_b, ph_id)
end

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

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

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

function PGE(z_b, gv, PC_read, SS_objective, NLopt_opt, splx_data, PP_ref_db, SS_ref_db, cp)
ccall((:PGE, libMAGEMin), global_variable, (bulk_info, global_variable, Ptr{PC_type}, Ptr{obj_type}, Ptr{NLopt_type}, Ptr{simplex_data}, Ptr{PP_ref}, Ptr{SS_ref}, Ptr{csd_phase_set}), z_b, gv, PC_read, SS_objective, NLopt_opt, splx_data, PP_ref_db, SS_ref_db, cp)
end
Expand Down Expand Up @@ -2477,6 +2561,14 @@ function get_tests_bulks(gv)
ccall((:get_tests_bulks, libMAGEMin), global_variable, (global_variable,), gv)
end

function vector_matrix_multiplication(v, M, result, vector_size, matrix_cols)
ccall((:vector_matrix_multiplication, libMAGEMin), Cvoid, (Ptr{Cdouble}, Ptr{Ptr{Cdouble}}, Ptr{Cdouble}, Cint, Cint), v, M, result, vector_size, matrix_cols)
end

function matrix_vector_multiplication(M, v, result, matrix_rows, matrix_cols)
ccall((:matrix_vector_multiplication, libMAGEMin), Cvoid, (Ptr{Ptr{Cdouble}}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint), M, v, result, matrix_rows, matrix_cols)
end

function get_act_sf_id(result, A, n)
ccall((:get_act_sf_id, libMAGEMin), Cvoid, (Ptr{Cint}, Ptr{Cdouble}, Cint), result, A, n)
end
Expand Down
Loading

0 comments on commit e04e939

Please sign in to comment.