diff --git a/PlotPseudosection.mlapp b/PlotPseudosection.mlapp index d476bff5..a1452544 100755 Binary files a/PlotPseudosection.mlapp and b/PlotPseudosection.mlapp differ diff --git a/Project.toml b/Project.toml index 7bcd5a9f..2575c439 100644 --- a/Project.toml +++ b/Project.toml @@ -1,15 +1,16 @@ name = "MAGEMin_C" uuid = "e5d170eb-415a-4524-987b-12f1bce1ddab" authors = ["Boris Kaus & Nicolas Riel "] -version = "1.2.8" +version = "1.3.3" [deps] CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" MAGEMin_jll = "763ebaa8-b0d2-5f6b-90ef-4fc23b5db1c4" +ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] CEnum = "0.4" +MAGEMin_jll = "1.3.1" +ProgressMeter = "1" julia = "1.6" - - diff --git a/doc_raw/ckbk.rst b/doc_raw/ckbk.rst index c340f9d2..3da684ae 100755 --- a/doc_raw/ckbk.rst +++ b/doc_raw/ckbk.rst @@ -37,3 +37,11 @@ Pseudosection generator :maxdepth: 2 ckbk/gui + +Predefined bulk-rocks +===================== + +.. toctree:: + :maxdepth: 2 + + ckbk/predef diff --git a/doc_raw/ckbk/predef.rst b/doc_raw/ckbk/predef.rst new file mode 100644 index 00000000..4359c7e2 --- /dev/null +++ b/doc_raw/ckbk/predef.rst @@ -0,0 +1,9 @@ +.. MAGEMin documentation + +List of pre-defined bulk-rock composition +========================================= + +.. csv-table:: Table Title + :file: /figs/predefined_bulks.csv + :widths: 10, 50, 10, 20, 20, 20 + :header-rows: 1 \ No newline at end of file diff --git a/doc_raw/figs/predefined_bulks.csv b/doc_raw/figs/predefined_bulks.csv new file mode 100644 index 00000000..6f3f61fa --- /dev/null +++ b/doc_raw/figs/predefined_bulks.csv @@ -0,0 +1,30 @@ +title,comments,test,oxide,frac,db +"FPWorldMedian pelite + Water oversaturated","Forshaw, J. B., & Pattison, D. R. (2023)",0,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O","70.999, 12.805, 0.771, 3.978, 6.342, 2.7895, 1.481, 0.758, 0.72933, 0.075, 30.0",mp +"FPWorldMedian pelite + Water undersaturated","Forshaw, J. B., & Pattison, D. R. (2023)",1,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O","70.999, 12.805, 0.771, 3.978, 6.342, 2.7895, 1.481, 0.758, 0.72933, 0.075, 5.0",mp +"Pelite + Water oversaturated","White et al., 2014, Fig 8",2,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O","64.578, 13.651, 1.586, 5.529, 8.025, 2.943, 2.0, 0.907, 0.65, 0.175, 40.0",mp +"Pelite + Water + undersaturated","White et al., 2014, Fig 8",3,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O","64.578, 13.651, 1.586, 5.529, 8.025, 2.943, 2.0, 0.907, 0.65, 0.175, 6.244",mp +"Garnet-migmatite + AV0832a","Riel et al., 2013",4,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O","73.988, 8.6143, 2.0146, 2.7401, 3.8451, 1.7686, 2.482, 0.6393, 0.11, 0.063, 10.0",mp +"SM89 + MORB composition","Sun & McDonough, 1989",0,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O","52.47, 9.1, 12.21, 12.71, 8.15, 0.23, 2.61, 1.05, 1.47, 20.0",mb +"Natural amphibolite + LT Granulite",unpublished,1,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O","51.08, 9.68, 13.26, 11.21, 11.66, 0.16, 0.79, 1.37, 0.8, 20.0",mb +"SQA + Synthetic amphibolite","Patino Douce & Beard, 1995",2,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O","60.05, 6.62, 8.31, 9.93, 6.57, 0.44, 1.83, 1.27, 0.33, 4.64",mb +BL478: Sample 478,"Beard & Lofgren, 1991",3,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O","53.96, 9.26, 10.15, 8.11, 10.14, 0.11, 2.54, 1.35, 0.98, 3.42",mb +"KLB1 Peridotite + Anhydrous","Holland et al., 2018",0,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","38.494, 1.776, 2.824, 50.566, 5.886, 0.01, 0.25, 0.1, 0.096, 0.109, 0.0",ig +"RE46 + Icelandic basalt","Yang et al., 1996",1,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","50.72, 9.16, 15.21, 16.25, 7.06, 0.01, 1.47, 0.39, 0.35, 0.01, 0.0",ig +N_MORB - Basalt,"Gale et al., 2013",2,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","53.21, 9.41, 12.21, 12.21, 8.65, 0.09, 2.9, 1.21, 0.69, 0.02, 0.0",ig +MIX1-G - Pyroxenite,"Hirschmann et al., 2003",3,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","45.25, 8.89, 12.22, 24.68, 6.45, 0.03, 1.39, 0.67, 0.11, 0.02, 0.0",ig +High-Al basalt,"Baker, 1983",4,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","54.4, 12.96, 11.31, 7.68, 8.63, 0.54, 3.93, 0.79, 0.41, 0.01, 0.0",ig +Tonalite 101,"Piwinskii, 1968",5,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","66.01, 11.98, 7.06, 4.16, 5.3, 1.57, 4.12, 0.66, 0.97, 0.01, 50.0",ig +Wet Basalt,unpublished,6,"SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O","50.081, 8.6901, 11.6698, 12.1438, 7.7832, 0.215, 2.4978, 1.0059, 0.467, 0.01, 5.4364",ig +Serpentine oxidized,"Evans & Forst, 2021",0,"SiO2, Al2O3, MgO, FeOt, O, H2O, S","20.044, 0.6256, 29.24, 3.149, 0.7324, 46.755, 0.3",um +Serpentine reduced,"Evans & Forst, 2021",1,"SiO2, Al2O3, MgO, FeOt, O, H2O, S","20.044, 0.6256, 29.24, 3.149, 0.1324, 46.755, 0.3",um diff --git a/doc_raw/index.rst b/doc_raw/index.rst index 52f15824..e98bbac8 100755 --- a/doc_raw/index.rst +++ b/doc_raw/index.rst @@ -10,7 +10,7 @@ | -**MAGEMin v1.3.2** +**MAGEMin v1.3.3** ================== 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 diff --git a/doc_raw/julia/Run.rst b/doc_raw/julia/Run.rst index e0ce3751..2de4b236 100755 --- a/doc_raw/julia/Run.rst +++ b/doc_raw/julia/Run.rst @@ -1,7 +1,7 @@ .. MAGEMin documentation -Single point calculation Tutorial +Serial point calculation Tutorial ================================= First open a terminal and execute Julia, then type :literal:`using MAGEMin_C` to load the package. @@ -12,22 +12,22 @@ Initialize database ******************* .. code-block:: shell - db = "ig" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b) - gv, z_b, DB, splx_data = init_MAGEMin(db); + # Initialize database - new way + db = "ig" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b); um, ultramafic (Evans & Frost 2021) + data = Initialize_MAGEMin(db, verbose=true); This initiatizes the global variables and the Database. +| + Set P-T-(pressure temperature) ********************************************************** .. code-block:: shell - P = 8. - T = 800. - sys_in = "mol" # wt or mol, default is mol - test = 0; - gv = use_predefined_bulk_rock(gv, test, db) + P = 8.0 + T = 800.0 -:literal:`get_bulk_rock` retrieves the saved bulk-rock composition 0, which corresponds to KLB-1 peridotite. +:literal:`use_predefined_bulk_rock` retrieves the saved bulk-rock composition 0 from database ig, which corresponds to KLB-1 peridotite. | @@ -41,15 +41,36 @@ Use a pre-defined bulk-rock "test" composition test = 0; gv = use_predefined_bulk_rock(gv, test, db) +or a custom bulk-rock composition: + +.. code-block:: shell + + Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"]; + X = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]; + sys_in = "wt" + +Note that the system unit :literal:`[mol,wt]` has to be provided here. + +where :literal:`Xoxides` is a :literal:`Vector(String)` containing the oxide names and :literal:`X` is a :literal:`Vector(Float)` of the :literal:`[mol,wt]` fraction of the bulk-rock composition. +The function converts + + :literal:`SiO2`, ..., :literal:`FeO` and :literal:`Fe2O3` in system unit :literal:`[mol,wt]` + +to: + + :literal:`SiO2`, ..., :literal:`FeOt` and :literal:`O` in system unit :literal:`[mol]`. + +Note that if the provided bulk-rock composition includes more oxides than supported, they will be ignored and the composition will be renormalized accordingly. Moreover, if both :literal:`Fe2O3` and :literal:`O` are provided, :literal:`O` will be recalculated as function of :literal:`Fe2O3`. Thus, if you want to prescribe a different :literal:`O` content, do not define :literal:`Fe2O3`! + | -Set the level of verbose :literal:`[-1,0,1]` -******************************************** +Set the level of verbose :literal:`[false,true,1]` +************************************************** .. code-block:: shell - gv.verbose = -1 # switch off any verbose + gv.verbose = false # switch off any verbose -:literal:`-1`, none; :literal:`0`, stable phase assemblage; :literal:`1`, full verbose. By default :literal:`gv.verbose` = 0. +:literal:`false`, none; :literal:`true`, stable phase assemblage; :literal:`1`, full verbose. By default :literal:`gv.verbose` = true. | @@ -57,8 +78,15 @@ Call optimization routine for given P-T-X ***************************************** .. code-block:: shell - gv.verbose = -1 # switch off any verbose - out = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in) + out = single_point_minimization(P, T, data, test=0); + +if a predefined test is used (see :doc:`/ckbk/predef`) or: + +.. code-block:: shell + + out = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in) + +if a custom bulk-rock composition is provided. | @@ -104,48 +132,45 @@ The full description of what contains the output structure is given in the CookB | -Provide custom bulk rock composition -==================================== - +Examples of serial point calculation +************************************ -To define and use your own bulk rock composition we provide a routine that converts bulk-rock composition into the right MAGEMin format. - -* For the igneous database: .. code-block:: shell - bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"] - bulk_in = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0] - sys_in = "wt" - db = "ig" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b) - - gv = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db); - -* For the metapelite database + #load MAGEMin + using MAGEMin_C -.. code-block:: shell + data = Initialize_MAGEMin("ig", verbose=false); - bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"] - bulk_in = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0] - sys_in = "wt" - db = "mp" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b) + # One bulk rock for all points + P,T = 10.0, 1100.0 + Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"]; + X = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]; + sys_in = "wt" + out = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in) + Finalize_MAGEMin(data) - gv = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db); +for the metapelite database: +.. code-block:: shell -where :literal:`bulk_in_ox` is a :literal:`Vector(String)` containing the oxide names and :literal:`bulk_in` is a :literal:`Vector(Float)` of the :literal:`[mol,wt]` fraction of the bulk-rock composition. -The function converts + #load MAGEMin + using MAGEMin_C - :literal:`SiO2`, ..., :literal:`FeO` and :literal:`Fe2O3` in system unit :literal:`[mol,wt]` - -to: - - :literal:`SiO2`, ..., :literal:`FeOt` and :literal:`O` in system unit :literal:`[mol]`. + #initialize + data = Initialize_MAGEMin("mp", verbose=false); -Note that if the provided bulk-rock composition includes more oxides than supported, they will be ignored and the composition will be renormalized accordingly. Moreover, if both :literal:`Fe2O3` and :literal:`O` are provided, :literal:`O` will be recalculated as function of :literal:`Fe2O3`. Thus, if you want to prescribe a different :literal:`O` content, do not define :literal:`Fe2O3`! + # provide bulk-rock composition + P,T = 2.0, 650.0 + Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"] + X = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0] + sys_in = "wt" + out = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in) + Finalize_MAGEMin(data) -A full Julia script demonstrating how to use this function is provided below: +for the ultramafic database: .. code-block:: shell @@ -153,33 +178,38 @@ A full Julia script demonstrating how to use this function is provided below: using MAGEMin_C #initialize - db = "ig" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b) - gv, z_b, DB, splx_data = init_MAGEMin(db); + data = Initialize_MAGEMin("um", verbose=false); # provide bulk-rock composition - bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"]; - bulk_in = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]; - sys_in = "wt" + P,T = 2.0, 650.0 + out = single_point_minimization(P, T, data, test=0) + Finalize_MAGEMin(data) - # convert bulk rock - gv = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db); - # provide pressure and temperature conditions - P,T = 10.0, 1100.0; - # switch off any verbose - gv.verbose = -1 +Parallel point calculation Tutorial +=================================== - # perform minimization - out = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in) +To compute a list of single point calculation in parallel your can use the native Julia multi-threading. To activate multi-threading simply launch the Julia terminal as: - # print output - print_info(out) +.. code-block:: shell - # free memory - finalize_MAGEMin(gv,DB) + julia -t 4 -of for the metapelite database: +or + +.. code-block:: shell + + julia --threads 4 + +where the number of threads depends on your system, generally twice the number of cores. + +| + +Examples of serial point calculation +************************************ + +To run :literal:`n` points, using database :literal:`ig` and :literal:`test 0` (see :doc:`/ckbk/predef`): .. code-block:: shell @@ -187,28 +217,35 @@ of for the metapelite database: using MAGEMin_C #initialize - db = "mp" # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b) - gv, z_b, DB, splx_data = init_MAGEMin(db); + data = Initialize_MAGEMin("ig", verbose=false); + n = 100; + P = fill(8.0,n) + T = fill(800.0,n) + out = multi_point_minimization(P, T, data, test=1); + Finalize_MAGEMin(data) - # provide bulk-rock composition - bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"] - bulk_in = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0] - sys_in = "wt" +Here the results are stored in :literal:`out` as :literal:`out[1:end]`. Various bulk-rock compositions can be prescribed as: - # convert bulk rock - gv = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db); +.. code-block:: shell - # provide pressure and temperature conditions - P,T = 4.0, 800.0; + #load MAGEMin + using MAGEMin_C - # switch off any verbose - gv.verbose = -1 + #initialize + data = Initialize_MAGEMin("ig", verbose=false); - # perform minimization - out = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in) + #set P-T-X conditions + P = [10.0, 10.0]; + T = [1100.0, 1100.0]; + Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"]; + X1 = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]; + X2 = [49.43; 14.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]; + X = [X1,X2]; + sys_in = "wt" + out = multi_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in) - # print output - print_info(out) - # free memory - finalize_MAGEMin(gv,DB) +Other examples +============== + +Several additional tests are provided in :literal:`./test/runtests.jl`. diff --git a/docs/_images/math/05b5ca00acd3a38a5c091c0d12594b114be96d0c.svg b/docs/_images/math/05b5ca00acd3a38a5c091c0d12594b114be96d0c.svg index 7d1a2143..940c23fe 100644 --- a/docs/_images/math/05b5ca00acd3a38a5c091c0d12594b114be96d0c.svg +++ b/docs/_images/math/05b5ca00acd3a38a5c091c0d12594b114be96d0c.svg @@ -3,17 +3,17 @@ - - - - - - + + + + + + diff --git a/docs/_images/math/1c05d17338c05591f2bdf069f5a1d002d25faee7.svg b/docs/_images/math/1c05d17338c05591f2bdf069f5a1d002d25faee7.svg index 9027093b..5b2676e5 100644 --- a/docs/_images/math/1c05d17338c05591f2bdf069f5a1d002d25faee7.svg +++ b/docs/_images/math/1c05d17338c05591f2bdf069f5a1d002d25faee7.svg @@ -3,27 +3,27 @@ + + + + + + + + + + + - - - - - - - - - - - diff --git a/docs/_images/math/8f30c6a98f2c50c865135fa75dce37887542ab49.svg b/docs/_images/math/8f30c6a98f2c50c865135fa75dce37887542ab49.svg index c93cc508..7314c5ed 100644 --- a/docs/_images/math/8f30c6a98f2c50c865135fa75dce37887542ab49.svg +++ b/docs/_images/math/8f30c6a98f2c50c865135fa75dce37887542ab49.svg @@ -3,26 +3,26 @@ + + + + - - - - + + + + + - - - - - diff --git a/docs/_modules/MAGEMin.c.html b/docs/_modules/MAGEMin.c.html index b92bb10b..c16b478b 100644 --- a/docs/_modules/MAGEMin.c.html +++ b/docs/_modules/MAGEMin.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -420,12 +429,6 @@

    Source code for MAGEMin.c

     	else if (gv.EM_database == 2){
     		gv = get_bulk_igneous( gv );
     	}
    -	else if (gv.EM_database == 3){
    -		gv = get_bulk_igneous( gv );
    -	}
    -	else if (gv.EM_database == 6){
    -		gv = get_bulk_igneous_alk( gv );
    -	}
     	else if (gv.EM_database == 4){
     		gv = get_bulk_ultramafic( gv );
     	}
    @@ -930,14 +933,6 @@ 

    Source code for MAGEMin.c

     		SS_ig_objective_init_function(			SS_objective,
     												gv							);
     	}
    -	else if (EM_database == 3){			// igneousd database //
    -		SS_igd_objective_init_function(			SS_objective,
    -												gv							);
    -	}
    -	else if (EM_database == 6){			// igneous alk database //
    -		SS_alk_objective_init_function(			SS_objective,
    -												gv							);
    -	}
     	else if (EM_database == 4){			// ultramafic database //
     		SS_um_objective_init_function(			SS_objective,
     												gv							);
    @@ -1257,12 +1252,6 @@ 

    Source code for MAGEMin.c

     	else if (strcmp(gv.db, "ig") == 0){
     		gv.EM_database = 2;
     	}
    -	else if (strcmp(gv.db, "igd") == 0){
    -		gv.EM_database = 3;
    -	}
    -	else if (strcmp(gv.db, "alk") == 0){
    -		gv.EM_database = 6;
    -	}
     	else if (strcmp(gv.db, "um") == 0){
     		gv.EM_database = 4;
     	}
    diff --git a/docs/_modules/NLopt_opt_function.c.html b/docs/_modules/NLopt_opt_function.c.html
    index 129845e8..54684030 100644
    --- a/docs/_modules/NLopt_opt_function.c.html
    +++ b/docs/_modules/NLopt_opt_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -269,1851 +278,1221 @@

    Source code for NLopt_opt_function.c

     
     
    #define eps_sf -1e-10 // eps to shift site fraction from zero
    -/**************************************************************************************/ -/**************************************************************************************/ -/********************IGNEOUS ALKALINE DATABASE (Weller et al., 2023)*******************/ -/**************************************************************************************/ -/**************************************************************************************/ -
    [docs]/** - Inequality constraints for liq +
    [docs]/** + Inequality constraints for liq_mp */ -void liq_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - x[10]*(-x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) - 1.0/6.0*x[11]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) - 1.0/6.0*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) - 1.0/6.0*x[13]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 1.0); - result[1] = ( eps_sf + -x[10]*x[1] + x[10] - 7.0/6.0*x[11]*x[1] + 0.5*x[11] + 1.0/6.0*x[12]*x[1] - 7.0/6.0*x[13]*x[1] + 0.5*x[13] - x[1]); - result[2] = ( eps_sf + -x[0]*x[10] - 7.0/6.0*x[0]*x[11] + 1.0/6.0*x[0]*x[12] - 7.0/6.0*x[0]*x[13] - x[0] + x[10]); - result[3] = ( eps_sf + -x[10]*x[4] - 7.0/6.0*x[11]*x[4] + x[11] + 1.0/6.0*x[12]*x[4] - 7.0/6.0*x[13]*x[4] - x[4]); - result[4] = ( eps_sf + -x[10]*x[5] - 7.0/6.0*x[11]*x[5] + 1.0/6.0*x[12]*x[5] - 7.0/6.0*x[13]*x[5] - x[5]); - result[5] = ( eps_sf + -x[10]*x[6] - 7.0/6.0*x[11]*x[6] + 1.0/6.0*x[12]*x[6] - 7.0/6.0*x[13]*x[6] - x[6]); - result[6] = ( eps_sf + -x[10]*x[7] - 7.0/6.0*x[11]*x[7] + 1.0/6.0*x[12]*x[7] - 7.0/6.0*x[13]*x[7] - x[7]); - result[7] = ( eps_sf + -x[10]*x[8] - 7.0/6.0*x[11]*x[8] + 1.0/6.0*x[12]*x[8] - 7.0/6.0*x[13]*x[8] + x[13] - x[8]); - result[8] = ( eps_sf + -x[11]); - result[9] = ( eps_sf + -x[10]); - result[10] = ( eps_sf + -x[12]); - result[11] = ( eps_sf + -x[13]); - result[12] = ( eps_sf + -x[10]*(x[2] + x[3]) - 7.0/6.0*x[11]*(x[2] + x[3]) + 1.0/6.0*x[12]*(x[2] + x[3]) + 0.5*x[12] - 7.0/6.0*x[13]*(x[2] + x[3]) - x[2] - x[3]); - result[13] = ( eps_sf + x[10]*x[9] + 7.0/6.0*x[11]*x[9] - 1.0/6.0*x[12]*x[9] + 7.0/6.0*x[13]*x[9] + x[9] - 1.0); - result[14] = ( eps_sf + -x[10]*x[9] - 7.0/6.0*x[11]*x[9] + 1.0/6.0*x[12]*x[9] - 7.0/6.0*x[13]*x[9] - x[9]); - result[15] = ( eps_sf + x[10]*x[9] + 7.0/6.0*x[11]*x[9] - 1.0/6.0*x[12]*x[9] + 7.0/6.0*x[13]*x[9] + x[9] - 1.0); - result[16] = ( eps_sf + 2.0*x[12] - 4.0*x[2]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0)); - result[17] = ( eps_sf + -4.0*x[3]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0)); - result[18] = ( eps_sf + -x[0]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0) + x[10]); - result[19] = ( eps_sf + x[10] + 0.5*x[11] + 0.5*x[13] - x[1]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0)); - result[20] = ( eps_sf + 2.0*x[10] + 0.5*x[11] + 2.0*x[12] + 0.5*x[13] - (x[0] + x[1] + 4.0*x[2] + 4.0*x[3])*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0)); +void liq_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[6] - 1.0); + result[1] = ( eps_sf + -x[0]); + result[2] = ( eps_sf + -x[1]*x[2]); + result[3] = ( eps_sf + -x[1]*(1.0 - x[2])); + result[4] = ( eps_sf + -x[3]); + result[5] = ( eps_sf + x[3] + x[1] + x[6] + x[4] + x[0] - 1.0); + result[6] = ( eps_sf + -x[4]); + result[7] = ( eps_sf + -x[5]); + result[8] = ( eps_sf + x[5] - 1.0); + result[9] = ( eps_sf + -x[6]); if (grad) { - grad[0] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[1] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[2] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[3] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[4] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[5] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[6] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[7] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[8] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[9] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[10] = x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 1.0; - grad[11] = 7.0/6.0*x[0] + 7.0/6.0*x[1] + 7.0/6.0*x[2] + 7.0/6.0*x[3] + 7.0/6.0*x[4] + 7.0/6.0*x[5] + 7.0/6.0*x[6] + 7.0/6.0*x[7] + 7.0/6.0*x[8] + 7.0/6.0*x[9] - 0.5; - grad[12] = -1.0/6.0*x[0] - 1.0/6.0*x[1] - 1.0/6.0*x[2] - 1.0/6.0*x[3] - 1.0/6.0*x[4] - 1.0/6.0*x[5] - 1.0/6.0*x[6] - 1.0/6.0*x[7] - 1.0/6.0*x[8] - 1.0/6.0*x[9] + 0.5; - grad[13] = 7.0/6.0*x[0] + 7.0/6.0*x[1] + 7.0/6.0*x[2] + 7.0/6.0*x[3] + 7.0/6.0*x[4] + 7.0/6.0*x[5] + 7.0/6.0*x[6] + 7.0/6.0*x[7] + 7.0/6.0*x[8] + 7.0/6.0*x[9] - 0.5; + grad[0] = 0.0; + grad[1] = 0.0; + grad[2] = 0.0; + grad[3] = 0.0; + grad[4] = 0.0; + grad[5] = 0.0; + grad[6] = 1.0; + grad[7] = -1.0; + grad[8] = 0.0; + grad[9] = 0.0; + grad[10] = 0.0; + grad[11] = 0.0; + grad[12] = 0.0; + grad[13] = 0.0; grad[14] = 0.0; - grad[15] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[16] = 0.0; + grad[15] = -x[2]; + grad[16] = -x[1]; grad[17] = 0.0; grad[18] = 0.0; grad[19] = 0.0; grad[20] = 0.0; grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 1.0 - x[1]; - grad[25] = 0.5 - 7.0/6.0*x[1]; - grad[26] = 1.0/6.0*x[1]; - grad[27] = 0.5 - 7.0/6.0*x[1]; - grad[28] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; + grad[22] = x[2] - 1.0; + grad[23] = x[1]; + grad[24] = 0.0; + grad[25] = 0.0; + grad[26] = 0.0; + grad[27] = 0.0; + grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; - grad[31] = 0.0; + grad[31] = -1.0; grad[32] = 0.0; grad[33] = 0.0; grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; + grad[35] = 1.0; + grad[36] = 1.0; grad[37] = 0.0; - grad[38] = 1.0 - x[0]; - grad[39] = -7.0/6.0*x[0]; - grad[40] = 1.0/6.0*x[0]; - grad[41] = -7.0/6.0*x[0]; + grad[38] = 1.0; + grad[39] = 1.0; + grad[40] = 0.0; + grad[41] = 1.0; grad[42] = 0.0; grad[43] = 0.0; grad[44] = 0.0; grad[45] = 0.0; - grad[46] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; + grad[46] = -1.0; grad[47] = 0.0; grad[48] = 0.0; grad[49] = 0.0; grad[50] = 0.0; grad[51] = 0.0; - grad[52] = -x[4]; - grad[53] = 1.0 - 7.0/6.0*x[4]; - grad[54] = 1.0/6.0*x[4]; - grad[55] = -7.0/6.0*x[4]; + grad[52] = 0.0; + grad[53] = 0.0; + grad[54] = -1.0; + grad[55] = 0.0; grad[56] = 0.0; grad[57] = 0.0; grad[58] = 0.0; grad[59] = 0.0; grad[60] = 0.0; - grad[61] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; + grad[61] = 1.0; grad[62] = 0.0; grad[63] = 0.0; grad[64] = 0.0; grad[65] = 0.0; - grad[66] = -x[5]; - grad[67] = -7.0/6.0*x[5]; - grad[68] = 1.0/6.0*x[5]; - grad[69] = -7.0/6.0*x[5]; - grad[70] = 0.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = -x[6]; - grad[81] = -7.0/6.0*x[6]; - grad[82] = 1.0/6.0*x[6]; - grad[83] = -7.0/6.0*x[6]; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = -x[7]; - grad[95] = -7.0/6.0*x[7]; - grad[96] = 1.0/6.0*x[7]; - grad[97] = -7.0/6.0*x[7]; - grad[98] = 0.0; - grad[99] = 0.0; - grad[100] = 0.0; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = 0.0; - grad[106] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[107] = 0.0; - grad[108] = -x[8]; - grad[109] = -7.0/6.0*x[8]; - grad[110] = 1.0/6.0*x[8]; - grad[111] = 1.0 - 7.0/6.0*x[8]; - grad[112] = 0.0; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 0.0; - grad[116] = 0.0; - grad[117] = 0.0; - grad[118] = 0.0; - grad[119] = 0.0; - grad[120] = 0.0; - grad[121] = 0.0; - grad[122] = 0.0; - grad[123] = -1.00; - grad[124] = 0.0; - grad[125] = 0.0; - grad[126] = 0.0; - grad[127] = 0.0; - grad[128] = 0.0; - grad[129] = 0.0; - grad[130] = 0.0; - grad[131] = 0.0; - grad[132] = 0.0; - grad[133] = 0.0; - grad[134] = 0.0; - grad[135] = 0.0; - grad[136] = -1.00; - grad[137] = 0.0; - grad[138] = 0.0; - grad[139] = 0.0; - grad[140] = 0.0; - grad[141] = 0.0; - grad[142] = 0.0; - grad[143] = 0.0; - grad[144] = 0.0; - grad[145] = 0.0; - grad[146] = 0.0; - grad[147] = 0.0; - grad[148] = 0.0; - grad[149] = 0.0; - grad[150] = 0.0; - grad[151] = 0.0; - grad[152] = -1.00; - grad[153] = 0.0; - grad[154] = 0.0; - grad[155] = 0.0; - grad[156] = 0.0; - grad[157] = 0.0; - grad[158] = 0.0; - grad[159] = 0.0; - grad[160] = 0.0; - grad[161] = 0.0; - grad[162] = 0.0; - grad[163] = 0.0; - grad[164] = 0.0; - grad[165] = 0.0; - grad[166] = 0.0; - grad[167] = -1.00; - grad[168] = 0.0; - grad[169] = 0.0; - grad[170] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[171] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[172] = 0.0; - grad[173] = 0.0; - grad[174] = 0.0; - grad[175] = 0.0; - grad[176] = 0.0; - grad[177] = 0.0; - grad[178] = -x[2] - x[3]; - grad[179] = -7.0/6.0*x[2] - 7.0/6.0*x[3]; - grad[180] = 1.0/6.0*x[2] + 1.0/6.0*x[3] + 0.5; - grad[181] = -7.0/6.0*x[2] - 7.0/6.0*x[3]; - grad[182] = 0.0; - grad[183] = 0.0; - grad[184] = 0.0; - grad[185] = 0.0; - grad[186] = 0.0; - grad[187] = 0.0; - grad[188] = 0.0; - grad[189] = 0.0; - grad[190] = 0.0; - grad[191] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[192] = x[9]; - grad[193] = 7.0/6.0*x[9]; - grad[194] = -1.0/6.0*x[9]; - grad[195] = 7.0/6.0*x[9]; - grad[196] = 0.0; - grad[197] = 0.0; - grad[198] = 0.0; - grad[199] = 0.0; - grad[200] = 0.0; - grad[201] = 0.0; - grad[202] = 0.0; - grad[203] = 0.0; - grad[204] = 0.0; - grad[205] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[206] = -x[9]; - grad[207] = -7.0/6.0*x[9]; - grad[208] = 1.0/6.0*x[9]; - grad[209] = -7.0/6.0*x[9]; - grad[210] = 0.0; - grad[211] = 0.0; - grad[212] = 0.0; - grad[213] = 0.0; - grad[214] = 0.0; - grad[215] = 0.0; - grad[216] = 0.0; - grad[217] = 0.0; - grad[218] = 0.0; - grad[219] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; - grad[220] = x[9]; - grad[221] = 7.0/6.0*x[9]; - grad[222] = -1.0/6.0*x[9]; - grad[223] = 7.0/6.0*x[9]; - grad[224] = 0.0; - grad[225] = 0.0; - grad[226] = -4.0*x[10] - 4.66666666666667*x[11] + 2.0/3.0*x[12] - 4.66666666666667*x[13] - 4.0; - grad[227] = 0.0; - grad[228] = 0.0; - grad[229] = 0.0; - grad[230] = 0.0; - grad[231] = 0.0; - grad[232] = 0.0; - grad[233] = 0.0; - grad[234] = -4.0*x[2]; - grad[235] = -4.66666666666667*x[2]; - grad[236] = 2.0/3.0*x[2] + 2.0; - grad[237] = -4.66666666666667*x[2]; - grad[238] = 0.0; - grad[239] = 0.0; - grad[240] = 0.0; - grad[241] = -4.0*x[10] - 4.66666666666667*x[11] + 2.0/3.0*x[12] - 4.66666666666667*x[13] - 4.0; - grad[242] = 0.0; - grad[243] = 0.0; - grad[244] = 0.0; - grad[245] = 0.0; - grad[246] = 0.0; - grad[247] = 0.0; - grad[248] = -4.0*x[3]; - grad[249] = -4.66666666666667*x[3]; - grad[250] = 2.0/3.0*x[3]; - grad[251] = -4.66666666666667*x[3]; - grad[252] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[253] = 0.0; - grad[254] = 0.0; - grad[255] = 0.0; - grad[256] = 0.0; - grad[257] = 0.0; - grad[258] = 0.0; - grad[259] = 0.0; - grad[260] = 0.0; - grad[261] = 0.0; - grad[262] = 1.0 - x[0]; - grad[263] = -7.0/6.0*x[0]; - grad[264] = 1.0/6.0*x[0]; - grad[265] = -7.0/6.0*x[0]; - grad[266] = 0.0; - grad[267] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[268] = 0.0; - grad[269] = 0.0; - grad[270] = 0.0; - grad[271] = 0.0; - grad[272] = 0.0; - grad[273] = 0.0; - grad[274] = 0.0; - grad[275] = 0.0; - grad[276] = 1.0 - x[1]; - grad[277] = 0.5 - 7.0/6.0*x[1]; - grad[278] = 1.0/6.0*x[1]; - grad[279] = 0.5 - 7.0/6.0*x[1]; - grad[280] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[281] = -x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; - grad[282] = -4.0*x[10] - 4.66666666666667*x[11] + 2.0/3.0*x[12] - 4.66666666666667*x[13] - 4.0; - grad[283] = -4.0*x[10] - 4.66666666666667*x[11] + 2.0/3.0*x[12] - 4.66666666666667*x[13] - 4.0; - grad[284] = 0.0; - grad[285] = 0.0; - grad[286] = 0.0; - grad[287] = 0.0; - grad[288] = 0.0; - grad[289] = 0.0; - grad[290] = -x[0] - x[1] - 4.0*x[2] - 4.0*x[3] + 2.0; - grad[291] = -7.0/6.0*x[0] - 7.0/6.0*x[1] - 4.66666666666667*x[2] - 4.66666666666667*x[3] + 0.5; - grad[292] = 1.0/6.0*x[0] + 1.0/6.0*x[1] + 2.0/3.0*x[2] + 2.0/3.0*x[3] + 2.0; - grad[293] = -7.0/6.0*x[0] - 7.0/6.0*x[1] - 4.66666666666667*x[2] - 4.66666666666667*x[3] + 0.5; + grad[66] = 0.0; + grad[67] = 0.0; + grad[68] = 0.0; + grad[69] = -1.0; } return; };
    -
    [docs]/** - Inequality constraints for fl +
    [docs]/** + Inequality constraints for st_mp */ -void fl_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] + x[2] - 1.0); - result[1] = ( eps_sf + -x[0]); +void st_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); + result[1] = ( eps_sf + x[1]*x[0] - x[0]); result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -x[2]); - result[4] = ( eps_sf + x[2] - 1.0); + result[3] = ( eps_sf + x[2] + 1.33333333333333*x[3] - 1.0); + result[4] = ( eps_sf + -x[2]); + result[5] = ( eps_sf + -x[3]); + result[6] = ( eps_sf + -1./3.*x[3]); if (grad) { - grad[0] = 1.00; - grad[1] = 1.00; - grad[2] = 1.00; - grad[3] = -1.00; - grad[4] = 0.0; - grad[5] = 0.0; + grad[0] = 1.0 - x[1]; + grad[1] = 1.0 - x[0]; + grad[2] = 0.0; + grad[3] = 0.0; + grad[4] = x[1] - 1.0; + grad[5] = x[0]; grad[6] = 0.0; - grad[7] = -1.00; + grad[7] = 0.0; grad[8] = 0.0; - grad[9] = 0.0; + grad[9] = -1.0; grad[10] = 0.0; - grad[11] = -1.00; + grad[11] = 0.0; grad[12] = 0.0; grad[13] = 0.0; - grad[14] = 1.00; + grad[14] = 1.0; + grad[15] = 1.33333333333333; + grad[16] = 0.0; + grad[17] = 0.0; + grad[18] = -1.0; + grad[19] = 0.0; + grad[20] = 0.0; + grad[21] = 0.0; + grad[22] = 0.0; + grad[23] = -1.0; + grad[24] = 0.0; + grad[25] = 0.0; + grad[26] = 0.0; + grad[27] = -1./3.; } return; };
    -
    [docs]/** - Inequality constraints for fsp +
    [docs]/** + Inequality constraints for sp_mp */ -void fsp_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -0.25*x[0] - 0.25); - result[4] = ( eps_sf + 0.25*x[0] - 0.75); +void sp_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[1]); + result[1] = ( eps_sf + x[1] + x[2] - 1.0); + result[2] = ( eps_sf + -x[2]); + result[3] = ( eps_sf + x[0] - 1.0); + result[4] = ( eps_sf + -x[0]); if (grad) { - grad[0] = 1.00; - grad[1] = 1.00; - grad[2] = -1.00; + grad[0] = 0.0; + grad[1] = -1.0; + grad[2] = 0.0; grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.00; - grad[6] = -0.250; + grad[4] = 1.0; + grad[5] = 1.0; + grad[6] = 0.0; grad[7] = 0.0; - grad[8] = 0.250; - grad[9] = 0.0; + grad[8] = -1.0; + grad[9] = 1.0; + grad[10] = 0.0; + grad[11] = 0.0; + grad[12] = -1.0; + grad[13] = 0.0; + grad[14] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for spn +
    [docs]/** + Inequality constraints for sa_mp */ -void spn_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] - 1.0/3.0*x[3] - 2.0/3.0*x[4] - 1.0/3.0); - result[1] = ( eps_sf + -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] - 2.0/3.0*x[5]); - result[2] = ( eps_sf + -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + 1.0/3.0*x[3] + 2.0/3.0*x[4] + 2.0/3.0*x[5] + 2.0/3.0*x[6] - 2.0/3.0); - result[3] = ( eps_sf + 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - 2.0/3.0*x[6]); - result[4] = ( eps_sf + 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] - 1.0/3.0*x[3] + 1.0/3.0*x[4] - 1.0/3.0); - result[5] = ( eps_sf + -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[5]); - result[6] = ( eps_sf + -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + x[2] + 0.833333333333333*x[3] - 1.0/3.0*x[4] - 1.0/3.0*x[5] - 1.0/3.0*x[6] - 2.0/3.0); - result[7] = ( eps_sf + 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] + 1.0/3.0*x[6]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -0.5*x[3]); +void sa_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[2]*x[0] + x[2] - 0.75*x[3] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + x[2]*x[0] + 0.75*x[3] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf + -x[2]); + result[3] = ( eps_sf + -x[1]); + result[4] = ( eps_sf + 0.25*x[3] + x[0] - 1.0); + result[5] = ( eps_sf + -0.25*x[3] - x[0]); + result[6] = ( eps_sf + x[2] + x[1] - 1.0); + result[7] = ( eps_sf + -x[2] - x[1]); if (grad) { - grad[0] = 1.0/3.0*x[3] + 1.0/3.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0/3.0*x[0] - 1.0/3.0; - grad[4] = -2.0/3.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = -1.0/3.0*x[3] - 1.0/3.0; + grad[0] = -x[2] - x[1] + 1.0; + grad[1] = 1.0 - x[0]; + grad[2] = 1.0 - x[0]; + grad[3] = -0.75; + grad[4] = x[2] + x[1] - 1.0; + grad[5] = x[0]; + grad[6] = x[0]; + grad[7] = 0.75; grad[8] = 0.0; grad[9] = 0.0; - grad[10] = -1.0/3.0*x[0]; + grad[10] = -1.0; grad[11] = 0.0; - grad[12] = -2.0/3.0; - grad[13] = 0.0; + grad[12] = 0.0; + grad[13] = -1.0; grad[14] = 0.0; - grad[15] = -2.0/3.0*x[2] - 2.0/3.0*x[3] + 2.0/3.0; - grad[16] = -2.0/3.0*x[1]; - grad[17] = 1.0/3.0 - 2.0/3.0*x[1]; - grad[18] = 2.0/3.0; - grad[19] = 2.0/3.0; - grad[20] = 2.0/3.0; + grad[15] = 0.0; + grad[16] = 1.0; + grad[17] = 0.0; + grad[18] = 0.0; + grad[19] = 0.25; + grad[20] = -1.0; grad[21] = 0.0; - grad[22] = 2.0/3.0*x[2] + 2.0/3.0*x[3] - 2.0/3.0; - grad[23] = 2.0/3.0*x[1]; - grad[24] = 2.0/3.0*x[1]; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = -2.0/3.0; - grad[28] = 1.0/3.0*x[3] + 1.0/3.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 1.0/3.0*x[0] - 1.0/3.0; - grad[32] = 1.0/3.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = -1.0/3.0*x[3] - 1.0/3.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.0/3.0*x[0]; - grad[39] = 0.0; - grad[40] = 1.0/3.0; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = -2.0/3.0*x[2] - 2.0/3.0*x[3] + 2.0/3.0; - grad[44] = 1.0 - 2.0/3.0*x[1]; - grad[45] = 0.833333333333333 - 2.0/3.0*x[1]; - grad[46] = -1.0/3.0; - grad[47] = -1.0/3.0; - grad[48] = -1.0/3.0; - grad[49] = 0.0; - grad[50] = 2.0/3.0*x[2] + 2.0/3.0*x[3] - 2.0/3.0; - grad[51] = 2.0/3.0*x[1]; - grad[52] = 2.0/3.0*x[1]; - grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 1.0/3.0; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = -1.00; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -0.500; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; + grad[22] = 0.0; + grad[23] = -0.25; + grad[24] = 0.0; + grad[25] = 1.0; + grad[26] = 1.0; + grad[27] = 0.0; + grad[28] = 0.0; + grad[29] = -1.0; + grad[30] = -1.0; + grad[31] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for g +
    [docs]/** + Inequality constraints for pl4tr_mp */ -void g_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] - x[0]); +void pl4tr_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + -x[0]); result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[2] + x[3] + 2.0*x[4] - 1.0); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + -x[2]); - result[6] = ( eps_sf + -x[4]); - result[7] = ( eps_sf + -x[4]); + result[3] = ( eps_sf + -0.25*x[0] - 0.25); + result[4] = ( eps_sf + 0.25*x[0] - 0.75); if (grad) { - grad[0] = 1.0 - x[1]; - grad[1] = 1.0 - x[0]; - grad[2] = 0.0; + grad[0] = 1.0; + grad[1] = 1.0; + grad[2] = -1.0; grad[3] = 0.0; grad[4] = 0.0; - grad[5] = x[1] - 1.0; - grad[6] = x[0]; + grad[5] = -1.0; + grad[6] = -0.25; grad[7] = 0.0; - grad[8] = 0.0; + grad[8] = 0.25; grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = -1.00; + } + + return; +};
    + +
    [docs]/** + Inequality constraints for opx_mp +*/ +void opx_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + 0.5*x[4]*x[5] - x[3]*x[0] + x[3] + 0.5*x[1]*x[5] - x[1]*x[0] + x[1] - 0.5*x[5] - x[0]*x[2] + x[0] + x[2] - 1.0); + result[1] = ( eps_sf + -0.5*x[4]*x[5] + x[3]*x[0] - 0.5*x[1]*x[5] + x[1]*x[0] + 0.5*x[5] + x[0]*x[2] - x[0]); + result[2] = ( eps_sf + -x[1]); + result[3] = ( eps_sf + -x[3]); + result[4] = ( eps_sf + -x[2]); + result[5] = ( eps_sf + -0.5*x[4]*x[5] - x[4]*x[0] + x[4] - 0.5*x[1]*x[5] - x[1]*x[0] + x[1] + 0.5*x[5] + x[0] - 1.0); + result[6] = ( eps_sf + 0.5*x[4]*x[5] + x[4]*x[0] + 0.5*x[1]*x[5] + x[1]*x[0] - 0.5*x[5] - x[0]); + result[7] = ( eps_sf + -x[1]); + result[8] = ( eps_sf + -x[4]); + result[9] = ( eps_sf + -0.5*x[3] - 0.5*x[2]); + result[10] = ( eps_sf + 0.5*x[3] + 0.5*x[2] - 1.0); + + if (grad) { + grad[0] = -x[3] - x[1] - x[2] + 1.0; + grad[1] = 0.5*x[5] - x[0] + 1.0; + grad[2] = 1.0 - x[0]; + grad[3] = 1.0 - x[0]; + grad[4] = 0.5*x[5]; + grad[5] = 0.5*x[4] + 0.5*x[1] - 0.5; + grad[6] = x[3] + x[1] + x[2] - 1.0; + grad[7] = -0.5*x[5] + x[0]; + grad[8] = x[0]; + grad[9] = x[0]; + grad[10] = -0.5*x[5]; + grad[11] = -0.5*x[4] - 0.5*x[1] + 0.5; grad[12] = 0.0; - grad[13] = 0.0; + grad[13] = -1.0; grad[14] = 0.0; grad[15] = 0.0; grad[16] = 0.0; - grad[17] = 1.00; - grad[18] = 1.00; - grad[19] = 2.00; + grad[17] = 0.0; + grad[18] = 0.0; + grad[19] = 0.0; grad[20] = 0.0; - grad[21] = 0.0; + grad[21] = -1.0; grad[22] = 0.0; - grad[23] = -1.00; + grad[23] = 0.0; grad[24] = 0.0; grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = -1.00; + grad[26] = -1.0; + grad[27] = 0.0; grad[28] = 0.0; grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; + grad[30] = -x[4] - x[1] + 1.0; + grad[31] = -0.5*x[5] - x[0] + 1.0; grad[32] = 0.0; grad[33] = 0.0; - grad[34] = -1.00; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; + grad[34] = -0.5*x[5] - x[0] + 1.0; + grad[35] = -0.5*x[4] - 0.5*x[1] + 0.5; + grad[36] = x[4] + x[1] - 1.0; + grad[37] = 0.5*x[5] + x[0]; grad[38] = 0.0; - grad[39] = -1.00; + grad[39] = 0.0; + grad[40] = 0.5*x[5] + x[0]; + grad[41] = 0.5*x[4] + 0.5*x[1] - 0.5; + grad[42] = 0.0; + grad[43] = -1.0; + grad[44] = 0.0; + grad[45] = 0.0; + grad[46] = 0.0; + grad[47] = 0.0; + grad[48] = 0.0; + grad[49] = 0.0; + grad[50] = 0.0; + grad[51] = 0.0; + grad[52] = -1.0; + grad[53] = 0.0; + grad[54] = 0.0; + grad[55] = 0.0; + grad[56] = -0.50; + grad[57] = -0.50; + grad[58] = 0.0; + grad[59] = 0.0; + grad[60] = 0.0; + grad[61] = 0.0; + grad[62] = 0.50; + grad[63] = 0.50; + grad[64] = 0.0; + grad[65] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for ol +
    [docs]/** + Inequality constraints for mu_mp */ -void ol_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - x[2] - 1.0); - result[1] = ( eps_sf + -x[0] + x[2]); - result[2] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] + x[2] - 1.0); - result[3] = ( eps_sf + x[0]*x[1] - x[0] - x[2]); - result[4] = ( eps_sf + -x[1]); +void mu_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[4] + x[3] - 1.0); + result[1] = ( eps_sf + -x[3]); + result[2] = ( eps_sf + -x[4]); + result[3] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); + result[4] = ( eps_sf + x[0]*x[1] - x[0]); + result[5] = ( eps_sf + -x[1]); + result[6] = ( eps_sf + x[2] - 1.0); + result[7] = ( eps_sf + -x[2]); + result[8] = ( eps_sf + 0.5*x[4] + 0.5*x[1] - 1.0); + result[9] = ( eps_sf + -0.5*x[4] - 0.5*x[1]); if (grad) { - grad[0] = 1.00; + grad[0] = 0.0; grad[1] = 0.0; - grad[2] = -1.00; - grad[3] = -1.00; - grad[4] = 0.0; - grad[5] = 1.00; - grad[6] = 1.0 - x[1]; - grad[7] = 1.0 - x[0]; - grad[8] = 1.00; - grad[9] = x[1] - 1.0; - grad[10] = x[0]; - grad[11] = -1.00; - grad[12] = 0.0; - grad[13] = -1.00; - grad[14] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for opx -*/ -void opx_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[1] + x[3]*x[5] - x[3]*x[7] + x[3] - x[5] + x[7] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] - x[0]*x[5] + x[0]*x[7] - x[0] + x[1]*x[3] - x[3]*x[5] + x[3]*x[7] - x[3]); - result[2] = ( eps_sf + -x[1] + x[4] + 2.0*x[5] + x[6] - x[7]); - result[3] = ( eps_sf + -x[4]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[5]); - result[6] = ( eps_sf + -x[0]*x[2] - x[0]*x[7] + x[0] + x[1]*x[3] + x[2] - x[3]*x[5] + x[3]*x[7] - x[3] + x[7] - 1.0); - result[7] = ( eps_sf + x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + 0.5*x[1] - 1.0); - result[11] = ( eps_sf + -0.5*x[1]); - - if (grad) { - grad[0] = -x[1] + x[5] - x[7] + 1.0; - grad[1] = -x[0] - x[3] + 1.0; grad[2] = 0.0; - grad[3] = -x[1] + x[5] - x[7] + 1.0; - grad[4] = 0.0; - grad[5] = x[0] + x[3] - 1.0; + grad[3] = 1.0; + grad[4] = 1.0; + grad[5] = 0.0; grad[6] = 0.0; - grad[7] = -x[0] - x[3] + 1.0; - grad[8] = x[1] - x[5] + x[7] - 1.0; - grad[9] = x[0] + x[3]; + grad[7] = 0.0; + grad[8] = -1.0; + grad[9] = 0.0; grad[10] = 0.0; - grad[11] = x[1] - x[5] + x[7] - 1.0; + grad[11] = 0.0; grad[12] = 0.0; - grad[13] = -x[0] - x[3]; - grad[14] = 0.0; - grad[15] = x[0] + x[3]; - grad[16] = 0.0; - grad[17] = -1.00; + grad[13] = 0.0; + grad[14] = -1.0; + grad[15] = 1.0 - x[1]; + grad[16] = 1.0 - x[0]; + grad[17] = 0.0; grad[18] = 0.0; grad[19] = 0.0; - grad[20] = 1.00; - grad[21] = 2.00; - grad[22] = 1.00; - grad[23] = -1.00; + grad[20] = x[1] - 1.0; + grad[21] = x[0]; + grad[22] = 0.0; + grad[23] = 0.0; grad[24] = 0.0; grad[25] = 0.0; - grad[26] = 0.0; + grad[26] = -1.0; grad[27] = 0.0; - grad[28] = -1.00; + grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; grad[31] = 0.0; - grad[32] = 0.0; + grad[32] = 1.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.00; + grad[37] = -1.0; + grad[38] = 0.0; grad[39] = 0.0; grad[40] = 0.0; - grad[41] = 0.0; + grad[41] = 0.50; grad[42] = 0.0; grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = -1.00; - grad[46] = 0.0; + grad[44] = 0.50; + grad[45] = 0.0; + grad[46] = -0.50; grad[47] = 0.0; - grad[48] = -x[2] - x[7] + 1.0; - grad[49] = x[3]; - grad[50] = 1.0 - x[0]; - grad[51] = x[1] - x[5] + x[7] - 1.0; - grad[52] = 0.0; - grad[53] = -x[3]; - grad[54] = 0.0; - grad[55] = -x[0] + x[3] + 1.0; - grad[56] = x[2] + x[7] - 1.0; - grad[57] = -x[3]; - grad[58] = x[0]; - grad[59] = -x[1] + x[5] - x[7] + 1.0; - grad[60] = 0.0; - grad[61] = x[3]; - grad[62] = 0.0; - grad[63] = x[0] - x[3]; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -1.00; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 0.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = -1.00; - grad[80] = 0.0; - grad[81] = 0.500; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = -0.500; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; + grad[48] = 0.0; + grad[49] = -0.50; } return; };
    -
    [docs]/** - Inequality constraints for cpx +
    [docs]/** + Inequality constraints for mt_mp */ -void cpx_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] + x[1] - x[3]*x[4] + x[3] + x[4]*x[7] - x[4]*x[8] + x[4] - x[7] + x[8] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + x[1]*x[4] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]); - result[2] = ( eps_sf + -x[1] - x[3] + x[5] + x[6] + 2.0*x[7] - x[8]); - result[3] = ( eps_sf + -x[5]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[7]); - result[6] = ( eps_sf + x[0]*x[2] + x[1]*x[4] - x[2] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]); - result[7] = ( eps_sf + -x[0]*x[2] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]); - result[8] = ( eps_sf + x[2] + x[3] + x[8] - 1.0); - result[9] = ( eps_sf + -x[3]); - result[10] = ( eps_sf + -x[8]); - result[11] = ( eps_sf + 0.5*x[1] - 1.0); - result[12] = ( eps_sf + -0.5*x[1]); +void mt_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + 0.5*x[0] - 0.5); + result[1] = ( eps_sf + 0.5*x[1] - x[0]); + result[2] = ( eps_sf + -0.5*x[1] + 0.5*x[0] - 0.5); + result[3] = ( eps_sf + -x[1]); + result[4] = ( eps_sf + x[1] - 1.0); + + if (grad) { + grad[0] = 0.50; + grad[1] = 0.0; + grad[2] = -1.0; + grad[3] = 0.50; + grad[4] = 0.50; + grad[5] = -0.50; + grad[6] = 0.0; + grad[7] = -1.0; + grad[8] = 0.0; + grad[9] = 1.0; + } + + return; +};
    + +
    [docs]/** + Inequality constraints for ma_mp +*/ +void ma_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[4] + x[3] - 1.0); + result[1] = ( eps_sf + -x[3]); + result[2] = ( eps_sf + -x[4]); + result[3] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); + result[4] = ( eps_sf + x[0]*x[1] - x[0]); + result[5] = ( eps_sf + -x[1]); + result[6] = ( eps_sf + x[2] - 1.0); + result[7] = ( eps_sf + -x[2]); + result[8] = ( eps_sf + 0.5*x[4] + 0.5*x[1] - 1.0); + result[9] = ( eps_sf + -0.5*x[4] - 0.5*x[1]); if (grad) { - grad[0] = -x[1] - x[3] + x[7] - x[8] + 1.0; - grad[1] = -x[0] - x[4] + 1.0; + grad[0] = 0.0; + grad[1] = 0.0; grad[2] = 0.0; - grad[3] = -x[0] - x[4] + 1.0; - grad[4] = -x[1] - x[3] + x[7] - x[8] + 1.0; + grad[3] = 1.0; + grad[4] = 1.0; grad[5] = 0.0; grad[6] = 0.0; - grad[7] = x[0] + x[4] - 1.0; - grad[8] = -x[0] - x[4] + 1.0; - grad[9] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[10] = x[0] + x[4]; + grad[7] = 0.0; + grad[8] = -1.0; + grad[9] = 0.0; + grad[10] = 0.0; grad[11] = 0.0; - grad[12] = x[0] + x[4]; - grad[13] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = -x[0] - x[4]; - grad[17] = x[0] + x[4]; + grad[12] = 0.0; + grad[13] = 0.0; + grad[14] = -1.0; + grad[15] = 1.0 - x[1]; + grad[16] = 1.0 - x[0]; + grad[17] = 0.0; grad[18] = 0.0; - grad[19] = -1.00; - grad[20] = 0.0; - grad[21] = -1.00; + grad[19] = 0.0; + grad[20] = x[1] - 1.0; + grad[21] = x[0]; grad[22] = 0.0; - grad[23] = 1.00; - grad[24] = 1.00; - grad[25] = 2.00; - grad[26] = -1.00; + grad[23] = 0.0; + grad[24] = 0.0; + grad[25] = 0.0; + grad[26] = -1.0; grad[27] = 0.0; grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; grad[31] = 0.0; - grad[32] = -1.00; + grad[32] = 1.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; grad[36] = 0.0; - grad[37] = 0.0; + grad[37] = -1.0; grad[38] = 0.0; grad[39] = 0.0; grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = -1.00; + grad[41] = 0.50; + grad[42] = 0.0; grad[43] = 0.0; - grad[44] = 0.0; + grad[44] = 0.50; grad[45] = 0.0; - grad[46] = 0.0; + grad[46] = -0.50; grad[47] = 0.0; grad[48] = 0.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = -1.00; - grad[53] = 0.0; - grad[54] = x[2]; - grad[55] = x[4]; - grad[56] = x[0] - 1.0; - grad[57] = x[4]; - grad[58] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = -x[4]; - grad[62] = x[4]; - grad[63] = -x[2]; - grad[64] = -x[4]; - grad[65] = -x[0]; - grad[66] = -x[4]; - grad[67] = -x[1] - x[3] + x[7] - x[8] + 1.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = x[4]; - grad[71] = -x[4]; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 1.00; - grad[75] = 1.00; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 1.00; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = -1.00; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = 0.0; - grad[98] = -1.00; - grad[99] = 0.0; - grad[100] = 0.500; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = 0.0; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = 0.0; - grad[109] = -0.500; - grad[110] = 0.0; - grad[111] = 0.0; - grad[112] = 0.0; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 0.0; - grad[116] = 0.0; + grad[49] = -0.50; } return; };
    -
    [docs]/** - Inequality constraints for ilm +
    [docs]/** + Inequality constraints for ilm_mp */ -void ilm_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] - 0.5*x[2]); - result[1] = ( eps_sf + -0.5*x[0] + 0.5*x[3]); - result[2] = ( eps_sf + x[0] - 1.0); - result[3] = ( eps_sf + -0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]); - result[4] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] + 0.5*x[2]); - result[5] = ( eps_sf + -0.5*x[0] - 0.5*x[3]); - result[6] = ( eps_sf + x[0] - 1.0); - result[7] = ( eps_sf + -0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]); +void ilm_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + 0.5*x[2] - 0.5*x[3] - 0.5*x[0] + 0.5*x[1]); + result[1] = ( eps_sf + 0.5*x[2] + 0.5*x[3] - 0.5*x[0] + 0.5*x[1]); + result[2] = ( eps_sf + -x[1]); + result[3] = ( eps_sf + -x[2]); + result[4] = ( eps_sf + x[0] - 1.0); + result[5] = ( eps_sf + -0.5*x[2] - 0.5*x[3] - 0.5*x[0] - 0.5*x[1]); if (grad) { - grad[0] = 0.5*x[1] - 0.5; - grad[1] = 0.5*x[0]; - grad[2] = -0.500; - grad[3] = 0.0; - grad[4] = -0.500; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.500; - grad[8] = 1.00; - grad[9] = 0.0; + grad[0] = -0.50; + grad[1] = 0.50; + grad[2] = 0.50; + grad[3] = -0.50; + grad[4] = -0.50; + grad[5] = 0.50; + grad[6] = 0.50; + grad[7] = 0.50; + grad[8] = 0.0; + grad[9] = -1.0; grad[10] = 0.0; grad[11] = 0.0; - grad[12] = -0.5*x[1]; - grad[13] = -0.5*x[0]; - grad[14] = 0.500; - grad[15] = -0.500; - grad[16] = 0.5*x[1] - 0.5; - grad[17] = 0.5*x[0]; - grad[18] = 0.500; + grad[12] = 0.0; + grad[13] = 0.0; + grad[14] = -1.0; + grad[15] = 0.0; + grad[16] = 1.0; + grad[17] = 0.0; + grad[18] = 0.0; grad[19] = 0.0; - grad[20] = -0.500; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -0.500; - grad[24] = 1.00; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = -0.5*x[1]; - grad[29] = -0.5*x[0]; - grad[30] = -0.500; - grad[31] = 0.500; + grad[20] = -0.50; + grad[21] = -0.50; + grad[22] = -0.50; + grad[23] = -0.50; } return; };
    -
    [docs]/** - Inequality constraints for ness +
    [docs]/** + Inequality constraints for g_mp */ -void ness_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -0.25*x[0]*x[1] - 0.75*x[1]*x[4] + x[1] - 0.25*x[2] + x[4] - 1.0); - result[1] = ( eps_sf + 0.25*x[0]*x[1] + 0.75*x[1]*x[4] - x[1] + 0.25*x[2]); - result[2] = ( eps_sf + -x[4]); - result[3] = ( eps_sf + -0.25*x[0]*x[1] + x[0] - 0.75*x[1]*x[4] + x[1] + 0.75*x[2] - 1.0); - result[4] = ( eps_sf + 0.25*x[0]*x[1] + 0.75*x[1]*x[4] - x[1] - 0.75*x[2]); - result[5] = ( eps_sf + -x[0]); - result[6] = ( eps_sf + 0.25*x[0] + x[3] - 0.75*x[4] - 1.0); - result[7] = ( eps_sf + -0.25*x[0] + 0.75*x[4]); - result[8] = ( eps_sf + -x[3]); +void g_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf - x[2]*x[0] + x[2] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + x[2]*x[0] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf - x[2]); + result[3] = ( eps_sf - x[1]); + result[4] = ( eps_sf - 1.0 + x[3]); + result[5] = ( eps_sf - x[3]); if (grad) { - grad[0] = -0.25*x[1]; - grad[1] = -0.25*x[0] - 0.75*x[4] + 1.0; - grad[2] = -0.250; + grad[0] = -x[2] - x[1] + 1.0; + grad[1] = 1.0 - x[0]; + grad[2] = 1.0 - x[0]; grad[3] = 0.0; - grad[4] = 1.0 - 0.75*x[1]; - grad[5] = 0.25*x[1]; - grad[6] = 0.25*x[0] + 0.75*x[4] - 1.0; - grad[7] = 0.250; + grad[4] = x[2] + x[1] - 1.0; + grad[5] = x[0]; + grad[6] = x[0]; + grad[7] = 0.0; grad[8] = 0.0; - grad[9] = 0.75*x[1]; - grad[10] = 0.0; + grad[9] = 0.0; + grad[10] = -1.0; grad[11] = 0.0; grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = -1.00; - grad[15] = 1.0 - 0.25*x[1]; - grad[16] = -0.25*x[0] - 0.75*x[4] + 1.0; - grad[17] = 0.750; + grad[13] = -1.0; + grad[14] = 0.0; + grad[15] = 0.0; + grad[16] = 0.0; + grad[17] = 0.0; grad[18] = 0.0; - grad[19] = -0.75*x[1]; - grad[20] = 0.25*x[1]; - grad[21] = 0.25*x[0] + 0.75*x[4] - 1.0; - grad[22] = -0.750; - grad[23] = 0.0; - grad[24] = 0.75*x[1]; - grad[25] = -1.00; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.250; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 1.00; - grad[34] = -0.750; - grad[35] = -0.250; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = 0.0; - grad[39] = 0.750; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = -1.00; - grad[44] = 0.0; - } + grad[19] = 1.0; + grad[20] = 0.0; + grad[21] = 0.0; + grad[22] = 0.0; + grad[23] = -1.0; + } return; };
    -
    [docs]/** - Inequality constraints for lct +
    [docs]/** + Inequality constraints for ep_mp */ -void lct_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); +void ep_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0] + x[1]); + result[1] = ( eps_sf + x[0] - x[1] - 1.0); + result[2] = ( eps_sf + -x[0] - x[1]); + result[3] = ( eps_sf + x[0] + x[1] - 1.0); if (grad) { - grad[0] = -1.00; - grad[1] = 1.00; + grad[0] = -1.0; + grad[1] = 1.0; + grad[2] = 1.0; + grad[3] = -1.0; + grad[4] = -1.0; + grad[5] = -1.0; + grad[6] = 1.0; + grad[7] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for kals +
    [docs]/** + Inequality constraints for ctd_mp */ -void kals_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); +void ctd_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[2] - 1.0); + result[1] = ( eps_sf + -x[2]); + result[2] = ( eps_sf + x[1]*x[0] - x[0]); + result[3] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); + result[4] = ( eps_sf + -x[1]); if (grad) { - grad[0] = -1.00; - grad[1] = 1.00; + grad[0] = 0.0; + grad[1] = 0.0; + grad[2] = 1.0; + grad[3] = 0.0; + grad[4] = 0.0; + grad[5] = -1.0; + grad[6] = x[1] - 1.0; + grad[7] = x[0]; + grad[8] = 0.0; + grad[9] = 1.0 - x[1]; + grad[10] = 1.0 - x[0]; + grad[11] = 0.0; + grad[12] = 0.0; + grad[13] = -1.0; + grad[14] = 0.0; } return; -};
    +}
    -
    [docs]/** - Inequality constraints for mel +
    [docs]/** + Inequality constraints for chl_mp */ -void mel_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[1]); - result[1] = ( eps_sf + x[1] - 1.0); - result[2] = ( eps_sf + -x[0]*x[2] - x[0]*x[3] + x[0] + x[2] + x[3] - 1.0); - result[3] = ( eps_sf + x[0]*x[2] + x[0]*x[3] - x[0]); - result[4] = ( eps_sf + -x[2]); - result[5] = ( eps_sf + -x[3]); - result[6] = ( eps_sf + x[1] - 0.5*x[2] - 0.5*x[3]); - result[7] = ( eps_sf + -x[1] + 0.5*x[2] + 0.5*x[3] - 1.0); +void chl_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[3]*x[5] - x[3]*x[0] + x[3] - x[5]*x[4] + x[5]*x[1] - x[5] + x[4]*x[0] - x[4] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + -x[3]*x[5] + x[3]*x[0] + x[5]*x[4] - x[5]*x[1] + x[5] - x[4]*x[0] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf + x[4] - x[1]); + result[3] = ( eps_sf + -0.25*x[2]*x[6] - 0.25*x[3]*x[5] - x[3]*x[0] + x[3] + 0.25*x[5]*x[4] - 0.25*x[5]*x[1] + 0.25*x[5] - 0.25*x[6]*x[4] - 0.25*x[6]*x[1] + 0.25*x[6] + x[0] - 1.0); + result[4] = ( eps_sf + -x[3]); + result[5] = ( eps_sf + 0.25*x[2]*x[6] + 0.25*x[3]*x[5] + x[3]*x[0] - 0.25*x[5]*x[4] + 0.25*x[5]*x[1] - 0.25*x[5] + 0.25*x[6]*x[4] + 0.25*x[6]*x[1] - 0.25*x[6] - x[0]); + result[6] = ( eps_sf + x[2]*x[6] - x[2]*x[0] + x[2] + x[6]*x[4] + x[6]*x[1] - x[6] - x[4]*x[0] + x[4] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[7] = ( eps_sf + -x[2]*x[6] + x[2]*x[0] - x[6]*x[4] - x[6]*x[1] + x[6] + x[4]*x[0] + x[0]*x[1] - x[0]); + result[8] = ( eps_sf + -x[2]); + result[9] = ( eps_sf + -x[4] - x[1]); + result[10] = ( eps_sf + 0.5*x[2] + x[1] - 1.0); + result[11] = ( eps_sf + -0.5*x[2] - x[1]); if (grad) { - grad[0] = 0.0; - grad[1] = -1.00; + grad[0] = -x[3] + x[4] - x[1] + 1.0; + grad[1] = x[5] - x[0] + 1.0; grad[2] = 0.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = 1.00; + grad[3] = x[5] - x[0] + 1.0; + grad[4] = -x[5] + x[0] - 1.0; + grad[5] = x[3] - x[4] + x[1] - 1.0; grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = -x[2] - x[3] + 1.0; + grad[7] = x[3] - x[4] + x[1] - 1.0; + grad[8] = -x[5] + x[0]; grad[9] = 0.0; - grad[10] = 1.0 - x[0]; - grad[11] = 1.0 - x[0]; - grad[12] = x[2] + x[3] - 1.0; + grad[10] = -x[5] + x[0]; + grad[11] = x[5] - x[0]; + grad[12] = -x[3] + x[4] - x[1] + 1.0; grad[13] = 0.0; - grad[14] = x[0]; - grad[15] = x[0]; + grad[14] = 0.0; + grad[15] = -1.0; grad[16] = 0.0; grad[17] = 0.0; - grad[18] = -1.00; + grad[18] = 1.0; grad[19] = 0.0; grad[20] = 0.0; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -1.00; - grad[24] = 0.0; - grad[25] = 1.00; - grad[26] = -0.500; - grad[27] = -0.500; + grad[21] = 1.0 - x[3]; + grad[22] = -0.25*x[5] - 0.25*x[6]; + grad[23] = -0.25*x[6]; + grad[24] = -0.25*x[5] - x[0] + 1.0; + grad[25] = 0.25*x[5] - 0.25*x[6]; + grad[26] = -0.25*x[3] + 0.25*x[4] - 0.25*x[1] + 0.25; + grad[27] = -0.25*x[2] - 0.25*x[4] - 0.25*x[1] + 0.25; grad[28] = 0.0; - grad[29] = -1.00; - grad[30] = 0.500; - grad[31] = 0.500; + grad[29] = 0.0; + grad[30] = 0.0; + grad[31] = -1.0; + grad[32] = 0.0; + grad[33] = 0.0; + grad[34] = 0.0; + grad[35] = x[3] - 1.0; + grad[36] = 0.25*x[5] + 0.25*x[6]; + grad[37] = 0.25*x[6]; + grad[38] = 0.25*x[5] + x[0]; + grad[39] = -0.25*x[5] + 0.25*x[6]; + grad[40] = 0.25*x[3] - 0.25*x[4] + 0.25*x[1] - 0.25; + grad[41] = 0.25*x[2] + 0.25*x[4] + 0.25*x[1] - 0.25; + grad[42] = -x[2] - x[4] - x[1] + 1.0; + grad[43] = x[6] - x[0] + 1.0; + grad[44] = x[6] - x[0] + 1.0; + grad[45] = 0.0; + grad[46] = x[6] - x[0] + 1.0; + grad[47] = 0.0; + grad[48] = x[2] + x[4] + x[1] - 1.0; + grad[49] = x[2] + x[4] + x[1] - 1.0; + grad[50] = -x[6] + x[0]; + grad[51] = -x[6] + x[0]; + grad[52] = 0.0; + grad[53] = -x[6] + x[0]; + grad[54] = 0.0; + grad[55] = -x[2] - x[4] - x[1] + 1.0; + grad[56] = 0.0; + grad[57] = 0.0; + grad[58] = -1.0; + grad[59] = 0.0; + grad[60] = 0.0; + grad[61] = 0.0; + grad[62] = 0.0; + grad[63] = 0.0; + grad[64] = -1.0; + grad[65] = 0.0; + grad[66] = 0.0; + grad[67] = -1.0; + grad[68] = 0.0; + grad[69] = 0.0; + grad[70] = 0.0; + grad[71] = 1.0; + grad[72] = 0.50; + grad[73] = 0.0; + grad[74] = 0.0; + grad[75] = 0.0; + grad[76] = 0.0; + grad[77] = 0.0; + grad[78] = -1.0; + grad[79] = -0.50; + grad[80] = 0.0; + grad[81] = 0.0; + grad[82] = 0.0; + grad[83] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for hb +
    [docs]/** + Inequality constraints for cd_mp */ -void hb_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[3] - 1.0); - result[1] = ( eps_sf + x[3]*x[4] - x[3]); - result[2] = ( eps_sf + -x[3]*x[4]); - result[3] = ( eps_sf + x[0] - x[8] - 1.0); - result[4] = ( eps_sf + -x[0] + x[8]); - result[5] = ( eps_sf + -x[0]*x[1] - x[0]*x[6] - x[0]*x[7] + x[0] + x[1]*x[9] + x[1] + x[6]*x[9] + x[6] + x[7]*x[9] + x[7] - x[9] - 1.0); - result[6] = ( eps_sf + x[0]*x[1] + x[0]*x[6] + x[0]*x[7] - x[0] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + x[9]); - result[7] = ( eps_sf + -x[1]); - result[8] = ( eps_sf + -x[6]); - result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + -x[5]); - result[11] = ( eps_sf + -x[0]*x[2] - x[0]*x[5] + x[0] - x[1]*x[9] + x[2] + x[5] - x[6]*x[9] - x[7]*x[9] + 1.5*x[8] + x[9] - 1.0); - result[12] = ( eps_sf + x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9]); - result[13] = ( eps_sf + -x[2]); - result[14] = ( eps_sf + 0.5*x[1] - 0.5*x[2] + 0.25*x[3] + 0.5*x[6] + 0.5*x[7] - 1.0); - result[15] = ( eps_sf + -0.5*x[1] + 0.5*x[2] - 0.25*x[3] - 0.5*x[6] - 0.5*x[7]); - result[16] = ( eps_sf + x[7] - 1.0); - result[17] = ( eps_sf + -x[7]); +void cd_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]); + result[1] = ( eps_sf + x[0] - 1.0); + result[2] = ( eps_sf + -x[1]); + result[3] = ( eps_sf + -x[2]); + result[4] = ( eps_sf + x[2] - 1.0); if (grad) { - grad[0] = 0.0; + grad[0] = -1.0; grad[1] = 0.0; grad[2] = 0.0; - grad[3] = 1.00; + grad[3] = 1.0; grad[4] = 0.0; grad[5] = 0.0; grad[6] = 0.0; - grad[7] = 0.0; + grad[7] = -1.0; grad[8] = 0.0; grad[9] = 0.0; grad[10] = 0.0; - grad[11] = 0.0; + grad[11] = -1.0; grad[12] = 0.0; - grad[13] = x[4] - 1.0; - grad[14] = x[3]; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; + grad[13] = 0.0; + grad[14] = 1.0; + } + + return; +};
    + +
    [docs]/** + Inequality constraints for bi_mp +*/ +void bi_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf - x[3]*x[0] + x[3] - 3.0*x[1]*x[0] + x[1] + 2.0/3.0*x[5] - x[4]*x[0] + x[4] - x[0]*x[2] + x[0] + x[2] - 1.0); + result[1] = ( eps_sf - x[1]); + result[2] = ( eps_sf + x[3]*x[0] + 3.0*x[1]*x[0] - 2.0/3.0*x[5] + x[4]*x[0] + x[0]*x[2] - x[0]); + result[3] = ( eps_sf - x[3]); + result[4] = ( eps_sf - x[4]); + result[5] = ( eps_sf - x[2]); + result[6] = ( eps_sf + x[1] - 1.0/3.0*x[5] + x[0] - 1.0); + result[7] = ( eps_sf - x[1]); + result[8] = ( eps_sf + 1.0/3.0*x[5] - x[0]); + result[9] = ( eps_sf + 0.5*x[3] + 0.5*x[2] - 0.5); + result[10] = ( eps_sf - 0.5*x[3] - 0.5*x[2] - 0.5); + result[11] = ( eps_sf + x[4] - 1.0); + result[12] = ( eps_sf - x[4]); + + if (grad) { + grad[0] = -x[3] - 3.0*x[1] - x[4] - x[2] + 1.0; + grad[1] = 1.0 - 3.0*x[0]; + grad[2] = 1.0 - x[0]; + grad[3] = 1.0 - x[0]; + grad[4] = 1.0 - x[0]; + grad[5] = 2.0/3.0; + grad[6] = 0.0; + grad[7] = -1.0; + grad[8] = 0.0; + grad[9] = 0.0; + grad[10] = 0.0; + grad[11] = 0.0; + grad[12] = x[3] + 3.0*x[1] + x[4] + x[2] - 1.0; + grad[13] = 3.0*x[0]; + grad[14] = x[0]; + grad[15] = x[0]; + grad[16] = x[0]; + grad[17] = -2.0/3.0; grad[18] = 0.0; grad[19] = 0.0; grad[20] = 0.0; - grad[21] = 0.0; + grad[21] = -1.0; grad[22] = 0.0; - grad[23] = -x[4]; - grad[24] = -x[3]; + grad[23] = 0.0; + grad[24] = 0.0; grad[25] = 0.0; grad[26] = 0.0; grad[27] = 0.0; - grad[28] = 0.0; + grad[28] = -1.0; grad[29] = 0.0; - grad[30] = 1.00; + grad[30] = 0.0; grad[31] = 0.0; - grad[32] = 0.0; + grad[32] = -1.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.00; + grad[36] = 1.0; + grad[37] = 1.0; + grad[38] = 0.0; grad[39] = 0.0; - grad[40] = -1.00; - grad[41] = 0.0; + grad[40] = 0.0; + grad[41] = -1.0/3.0; grad[42] = 0.0; - grad[43] = 0.0; + grad[43] = -1.0; grad[44] = 0.0; grad[45] = 0.0; grad[46] = 0.0; grad[47] = 0.0; - grad[48] = 1.00; + grad[48] = -1.0; grad[49] = 0.0; - grad[50] = -x[1] - x[6] - x[7] + 1.0; - grad[51] = -x[0] + x[9] + 1.0; + grad[50] = 0.0; + grad[51] = 0.0; grad[52] = 0.0; - grad[53] = 0.0; + grad[53] = 1.0/3.0; grad[54] = 0.0; grad[55] = 0.0; - grad[56] = -x[0] + x[9] + 1.0; - grad[57] = -x[0] + x[9] + 1.0; + grad[56] = 0.50; + grad[57] = 0.50; grad[58] = 0.0; - grad[59] = x[1] + x[6] + x[7] - 1.0; - grad[60] = x[1] + x[6] + x[7] - 1.0; - grad[61] = x[0] - x[9]; - grad[62] = 0.0; - grad[63] = 0.0; + grad[59] = 0.0; + grad[60] = 0.0; + grad[61] = 0.0; + grad[62] = -0.50; + grad[63] = -0.50; grad[64] = 0.0; grad[65] = 0.0; - grad[66] = x[0] - x[9]; - grad[67] = x[0] - x[9]; + grad[66] = 0.0; + grad[67] = 0.0; grad[68] = 0.0; - grad[69] = -x[1] - x[6] - x[7] + 1.0; - grad[70] = 0.0; - grad[71] = -1.00; + grad[69] = 0.0; + grad[70] = 1.0; + grad[71] = 0.0; grad[72] = 0.0; grad[73] = 0.0; grad[74] = 0.0; grad[75] = 0.0; - grad[76] = 0.0; + grad[76] = -1.0; grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 0.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = -1.00; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = -1.00; - grad[98] = 0.0; - grad[99] = 0.0; - grad[100] = 0.0; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = -1.00; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = 0.0; - grad[109] = 0.0; - grad[110] = -x[2] - x[5] + 1.0; - grad[111] = -x[9]; - grad[112] = 1.0 - x[0]; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 1.0 - x[0]; - grad[116] = -x[9]; - grad[117] = -x[9]; - grad[118] = 1.50; - grad[119] = -x[1] - x[6] - x[7] + 1.0; - grad[120] = x[2] + x[5] - 1.0; - grad[121] = x[9]; - grad[122] = x[0]; - grad[123] = 0.0; - grad[124] = 0.0; - grad[125] = x[0]; - grad[126] = x[9]; - grad[127] = x[9]; - grad[128] = -1.50; - grad[129] = x[1] + x[6] + x[7] - 1.0; - grad[130] = 0.0; - grad[131] = 0.0; - grad[132] = -1.00; - grad[133] = 0.0; - grad[134] = 0.0; - grad[135] = 0.0; - grad[136] = 0.0; - grad[137] = 0.0; - grad[138] = 0.0; - grad[139] = 0.0; - grad[140] = 0.0; - grad[141] = 0.500; - grad[142] = -0.500; - grad[143] = 0.250; - grad[144] = 0.0; - grad[145] = 0.0; - grad[146] = 0.500; - grad[147] = 0.500; - grad[148] = 0.0; - grad[149] = 0.0; - grad[150] = 0.0; - grad[151] = -0.500; - grad[152] = 0.500; - grad[153] = -0.250; - grad[154] = 0.0; - grad[155] = 0.0; - grad[156] = -0.500; - grad[157] = -0.500; - grad[158] = 0.0; - grad[159] = 0.0; - grad[160] = 0.0; - grad[161] = 0.0; - grad[162] = 0.0; - grad[163] = 0.0; - grad[164] = 0.0; - grad[165] = 0.0; - grad[166] = 0.0; - grad[167] = 1.00; - grad[168] = 0.0; - grad[169] = 0.0; - grad[170] = 0.0; - grad[171] = 0.0; - grad[172] = 0.0; - grad[173] = 0.0; - grad[174] = 0.0; - grad[175] = 0.0; - grad[176] = 0.0; - grad[177] = -1.00; - grad[178] = 0.0; - grad[179] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for bi -*/ -void bi_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[0] + x[1] + x[2] + x[3] + 2.0/3.0*x[4] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - 2.0/3.0*x[4]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[3]); - result[4] = ( eps_sf + -x[1]); - result[5] = ( eps_sf + x[0] - 1.0/3.0*x[4] - 1.0); - result[6] = ( eps_sf + -x[0] + 1.0/3.0*x[4]); - result[7] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 0.5); - result[8] = ( eps_sf + -0.5*x[1] - 0.5*x[2] - 0.5); - result[9] = ( eps_sf + x[3] - 1.0); - result[10] = ( eps_sf + -x[3]); - - if (grad) { - grad[0] = -x[1] - x[2] - x[3] + 1.0; - grad[1] = 1.0 - x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = 1.0 - x[0]; - grad[4] = 2.0/3.0; - grad[5] = x[1] + x[2] + x[3] - 1.0; - grad[6] = x[0]; - grad[7] = x[0]; - grad[8] = x[0]; - grad[9] = -2.0/3.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = -1.00; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = -1.00; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = -1.00; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 1.00; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = -1.0/3.0; - grad[30] = -1.00; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 1.0/3.0; - grad[35] = 0.0; - grad[36] = 0.500; - grad[37] = 0.500; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = -0.500; - grad[42] = -0.500; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 1.00; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; - grad[53] = -1.00; - grad[54] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for ep -*/ -void ep_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0] + x[1]); - result[1] = ( eps_sf + x[0] - x[1] - 1.0); - result[2] = ( eps_sf + -x[0] - x[1]); - result[3] = ( eps_sf + x[0] + x[1] - 1.0); - - if (grad) { - grad[0] = -1.00; - grad[1] = 1.00; - grad[2] = 1.00; - grad[3] = -1.00; - grad[4] = -1.00; - grad[5] = -1.00; - grad[6] = 1.00; - grad[7] = 1.00; - } - - return; -};
    -
    [docs]/** - Inequality constraints for cd +
    [docs]/** + Inequality constraints for fper_S11 */ -void cd_alk_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); +void fper_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -1.0*x[0]); result[1] = ( eps_sf + x[0] - 1.0); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[1] - 1.0); if (grad) { - grad[0] = -1.00; - grad[1] = 0.0; - grad[2] = 1.00; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.00; - grad[6] = 0.0; - grad[7] = 1.00; + grad[0] = -1.0; + grad[1] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for liq +
    [docs]/** + local minimization for clinopyroxene */ -void liq_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - x[10]*(-x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) - 2./3.*x[11]*(-x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) - 1./6.*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) - 1./3.*x[13]*(-x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 1.0); - result[1] = ( eps_sf + -x[10]*x[1] + x[10] - 2./3.*x[11]*x[1] + 1./6.*x[12]*x[1] - 1./3.*x[13]*x[1] - x[1]); - result[2] = ( eps_sf + -x[0]*x[10] - 2./3.*x[0]*x[11] + 1./6.*x[0]*x[12] - 1./3.*x[0]*x[13] - x[0] + x[10]); - result[3] = ( eps_sf + -x[10]*x[4] - 2./3.*x[11]*x[4] + x[11] + 1./6.*x[12]*x[4] - 1./3.*x[13]*x[4] - x[4]); - result[4] = ( eps_sf + -x[10]*x[5] - 2./3.*x[11]*x[5] + 1./6.*x[12]*x[5] - 1./3.*x[13]*x[5] - x[5]); - result[5] = ( eps_sf + -x[10]*x[6] - 2./3.*x[11]*x[6] + 1./6.*x[12]*x[6] - 1./3.*x[13]*x[6] - x[6]); - result[6] = ( eps_sf + -x[10]*x[7] - 2./3.*x[11]*x[7] + 1./6.*x[12]*x[7] - 1./3.*x[13]*x[7] - x[7]); - result[7] = ( eps_sf + -x[10]*x[8] - 2./3.*x[11]*x[8] + 1./6.*x[12]*x[8] - 1./3.*x[13]*x[8] + x[13] - x[8]); - result[8] = ( eps_sf + -x[11]); - result[9] = ( eps_sf + -x[10]); - result[10] = ( eps_sf + -x[12]); - result[11] = ( eps_sf + -x[13]); - result[12] = ( eps_sf + -x[10]*(x[2] + x[3]) - 2./3.*x[11]*(x[2] + x[3]) + 1./6.*x[12]*(x[2] + x[3]) + 0.5*x[12] - 1./3.*x[13]*(x[2] + x[3]) - x[2] - x[3]); - result[13] = ( eps_sf + x[10]*x[9] + 2./3.*x[11]*x[9] - 1./6.*x[12]*x[9] + 1./3.*x[13]*x[9] + x[9] - 1.0); - result[14] = ( eps_sf + -x[10]*x[9] - 2./3.*x[11]*x[9] + 1./6.*x[12]*x[9] - 1./3.*x[13]*x[9] - x[9]); - result[15] = ( eps_sf + x[10]*x[9] + 2./3.*x[11]*x[9] - 1./6.*x[12]*x[9] + 1./3.*x[13]*x[9] + x[9] - 1.0); - result[16] = ( eps_sf + 2.0*x[12] - 4.0*x[2]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0)); - result[17] = ( eps_sf + -4.0*x[3]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0)); - result[18] = ( eps_sf + -x[0]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0) + x[10]); - result[19] = ( eps_sf + x[10] - x[1]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0)); - result[20] = ( eps_sf + 2.0*x[10] + 2.0*x[12] - (x[0] + x[1] + 4.0*x[2] + 4.0*x[3])*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0)); +void cpx_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[8]*x[4] - x[8]*x[0] + x[8] - x[3]*x[4] - x[3]*x[0] + x[3] + x[4]*x[7] - x[4]*x[1] + x[4] + x[7]*x[0] - x[7] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + x[8]*x[4] + x[8]*x[0] + x[3]*x[4] + x[3]*x[0] - x[4]*x[7] + x[4]*x[1] - x[4] - x[7]*x[0] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf + x[6] + x[5] - x[8] - x[3] + 2.0*x[7] - x[1]); + result[3] = ( eps_sf + -x[5]); + result[4] = ( eps_sf + -x[6]); + result[5] = ( eps_sf + -x[7]); + result[6] = ( eps_sf + x[8]*x[4] + x[3]*x[4] + x[2]*x[0] - x[2] - x[4]*x[7] + x[4]*x[1] - x[4]); + result[7] = ( eps_sf + -x[8]*x[4] - x[3]*x[4] - x[2]*x[0] + x[4]*x[7] - x[4]*x[1] + x[4]); + result[8] = ( eps_sf + x[8] + x[3] + x[2] - 1.0); + result[9] = ( eps_sf + -x[3]); + result[10] = ( eps_sf + -x[8]); + result[11] = ( eps_sf + 0.5*x[1] - 1.0); + result[12] = ( eps_sf + -0.5*x[1]); if (grad) { - grad[0] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[1] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[2] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[3] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[4] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[5] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[6] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[7] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[8] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[9] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[10] = x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 1.0; - grad[11] = 2./3.*x[0] + 2./3.*x[1] + 2./3.*x[2] + 2./3.*x[3] + 2./3.*x[4] + 2./3.*x[5] + 2./3.*x[6] + 2./3.*x[7] + 2./3.*x[8] + 2./3.*x[9]; - grad[12] = -1./6.*x[0] - 1./6.*x[1] - 1./6.*x[2] - 1./6.*x[3] - 1./6.*x[4] - 1./6.*x[5] - 1./6.*x[6] - 1./6.*x[7] - 1./6.*x[8] - 1./6.*x[9] + 0.5; - grad[13] = 1./3.*x[0] + 1./3.*x[1] + 1./3.*x[2] + 1./3.*x[3] + 1./3.*x[4] + 1./3.*x[5] + 1./3.*x[6] + 1./3.*x[7] + 1./3.*x[8] + 1./3.*x[9]; + grad[0] = -x[8] - x[3] + x[7] - x[1] + 1.0; + grad[1] = -x[4] - x[0] + 1.0; + grad[2] = 0.0; + grad[3] = -x[4] - x[0] + 1.0; + grad[4] = -x[8] - x[3] + x[7] - x[1] + 1.0; + grad[5] = 0.0; + grad[6] = 0.0; + grad[7] = x[4] + x[0] - 1.0; + grad[8] = -x[4] - x[0] + 1.0; + grad[9] = x[8] + x[3] - x[7] + x[1] - 1.0; + grad[10] = x[4] + x[0]; + grad[11] = 0.0; + grad[12] = x[4] + x[0]; + grad[13] = x[8] + x[3] - x[7] + x[1] - 1.0; grad[14] = 0.0; - grad[15] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[16] = 0.0; - grad[17] = 0.0; + grad[15] = 0.0; + grad[16] = -x[4] - x[0]; + grad[17] = x[4] + x[0]; grad[18] = 0.0; - grad[19] = 0.0; + grad[19] = -1.0; grad[20] = 0.0; - grad[21] = 0.0; + grad[21] = -1.0; grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 1.0 - x[1]; - grad[25] = -2./3.*x[1]; - grad[26] = 1./6.*x[1]; - grad[27] = -1./3.*x[1]; - grad[28] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; + grad[23] = 1.0; + grad[24] = 1.0; + grad[25] = 2.0; + grad[26] = -1.0; + grad[27] = 0.0; + grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; grad[31] = 0.0; - grad[32] = 0.0; + grad[32] = -1.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; grad[36] = 0.0; grad[37] = 0.0; - grad[38] = 1.0 - x[0]; - grad[39] = -2./3.*x[0]; - grad[40] = 1./6.*x[0]; - grad[41] = -1./3.*x[0]; - grad[42] = 0.0; + grad[38] = 0.0; + grad[39] = 0.0; + grad[40] = 0.0; + grad[41] = 0.0; + grad[42] = -1.0; grad[43] = 0.0; grad[44] = 0.0; grad[45] = 0.0; - grad[46] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; + grad[46] = 0.0; grad[47] = 0.0; grad[48] = 0.0; grad[49] = 0.0; grad[50] = 0.0; grad[51] = 0.0; - grad[52] = -x[4]; - grad[53] = 1.0 - 2./3.*x[4]; - grad[54] = 1./6.*x[4]; - grad[55] = -1./3.*x[4]; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = 0.0; + grad[52] = -1.0; + grad[53] = 0.0; + grad[54] = x[2]; + grad[55] = x[4]; + grad[56] = x[0] - 1.0; + grad[57] = x[4]; + grad[58] = x[8] + x[3] - x[7] + x[1] - 1.0; grad[59] = 0.0; grad[60] = 0.0; - grad[61] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -x[5]; - grad[67] = -2./3.*x[5]; - grad[68] = 1./6.*x[5]; - grad[69] = -1./3.*x[5]; - grad[70] = 0.0; - grad[71] = 0.0; + grad[61] = -x[4]; + grad[62] = x[4]; + grad[63] = -x[2]; + grad[64] = -x[4]; + grad[65] = -x[0]; + grad[66] = -x[4]; + grad[67] = -x[8] - x[3] + x[7] - x[1] + 1.0; + grad[68] = 0.0; + grad[69] = 0.0; + grad[70] = x[4]; + grad[71] = -x[4]; grad[72] = 0.0; grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; + grad[74] = 1.0; + grad[75] = 1.0; + grad[76] = 0.0; grad[77] = 0.0; grad[78] = 0.0; grad[79] = 0.0; - grad[80] = -x[6]; - grad[81] = -2./3.*x[6]; - grad[82] = 1./6.*x[6]; - grad[83] = -1./3.*x[6]; - grad[84] = 0.0; + grad[80] = 1.0; + grad[81] = 0.0; + grad[82] = 0.0; + grad[83] = 0.0; + grad[84] = -1.0; grad[85] = 0.0; grad[86] = 0.0; grad[87] = 0.0; grad[88] = 0.0; grad[89] = 0.0; grad[90] = 0.0; - grad[91] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; + grad[91] = 0.0; grad[92] = 0.0; grad[93] = 0.0; - grad[94] = -x[7]; - grad[95] = -2./3.*x[7]; - grad[96] = 1./6.*x[7]; - grad[97] = -1./3.*x[7]; - grad[98] = 0.0; + grad[94] = 0.0; + grad[95] = 0.0; + grad[96] = 0.0; + grad[97] = 0.0; + grad[98] = -1.0; grad[99] = 0.0; - grad[100] = 0.0; + grad[100] = 0.50; grad[101] = 0.0; grad[102] = 0.0; grad[103] = 0.0; grad[104] = 0.0; grad[105] = 0.0; - grad[106] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; + grad[106] = 0.0; grad[107] = 0.0; - grad[108] = -x[8]; - grad[109] = -2./3.*x[8]; - grad[110] = 1./6.*x[8]; - grad[111] = 1.0 - 1./3.*x[8]; + grad[108] = 0.0; + grad[109] = -0.50; + grad[110] = 0.0; + grad[111] = 0.0; grad[112] = 0.0; grad[113] = 0.0; grad[114] = 0.0; grad[115] = 0.0; grad[116] = 0.0; - grad[117] = 0.0; - grad[118] = 0.0; - grad[119] = 0.0; - grad[120] = 0.0; - grad[121] = 0.0; - grad[122] = 0.0; - grad[123] = -1.0; - grad[124] = 0.0; - grad[125] = 0.0; - grad[126] = 0.0; - grad[127] = 0.0; - grad[128] = 0.0; - grad[129] = 0.0; - grad[130] = 0.0; - grad[131] = 0.0; - grad[132] = 0.0; - grad[133] = 0.0; - grad[134] = 0.0; - grad[135] = 0.0; - grad[136] = -1.0; - grad[137] = 0.0; - grad[138] = 0.0; - grad[139] = 0.0; - grad[140] = 0.0; - grad[141] = 0.0; - grad[142] = 0.0; - grad[143] = 0.0; - grad[144] = 0.0; - grad[145] = 0.0; - grad[146] = 0.0; - grad[147] = 0.0; - grad[148] = 0.0; - grad[149] = 0.0; - grad[150] = 0.0; - grad[151] = 0.0; - grad[152] = -1.0; - grad[153] = 0.0; - grad[154] = 0.0; - grad[155] = 0.0; - grad[156] = 0.0; - grad[157] = 0.0; - grad[158] = 0.0; - grad[159] = 0.0; - grad[160] = 0.0; - grad[161] = 0.0; - grad[162] = 0.0; - grad[163] = 0.0; - grad[164] = 0.0; - grad[165] = 0.0; - grad[166] = 0.0; - grad[167] = -1.0; - grad[168] = 0.0; - grad[169] = 0.0; - grad[170] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[171] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[172] = 0.0; - grad[173] = 0.0; - grad[174] = 0.0; - grad[175] = 0.0; - grad[176] = 0.0; - grad[177] = 0.0; - grad[178] = -x[2] - x[3]; - grad[179] = -2./3.*x[2] - 2./3.*x[3]; - grad[180] = 1./6.*x[2] + 1./6.*x[3] + 0.5; - grad[181] = -1./3.*x[2] - 1./3.*x[3]; - grad[182] = 0.0; - grad[183] = 0.0; - grad[184] = 0.0; - grad[185] = 0.0; - grad[186] = 0.0; - grad[187] = 0.0; - grad[188] = 0.0; - grad[189] = 0.0; - grad[190] = 0.0; - grad[191] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[192] = x[9]; - grad[193] = 2./3.*x[9]; - grad[194] = -1./6.*x[9]; - grad[195] = 1./3.*x[9]; - grad[196] = 0.0; - grad[197] = 0.0; - grad[198] = 0.0; - grad[199] = 0.0; - grad[200] = 0.0; - grad[201] = 0.0; - grad[202] = 0.0; - grad[203] = 0.0; - grad[204] = 0.0; - grad[205] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[206] = -x[9]; - grad[207] = -2./3.*x[9]; - grad[208] = 1./6.*x[9]; - grad[209] = -1./3.*x[9]; - grad[210] = 0.0; - grad[211] = 0.0; - grad[212] = 0.0; - grad[213] = 0.0; - grad[214] = 0.0; - grad[215] = 0.0; - grad[216] = 0.0; - grad[217] = 0.0; - grad[218] = 0.0; - grad[219] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; - grad[220] = x[9]; - grad[221] = 2./3.*x[9]; - grad[222] = -1./6.*x[9]; - grad[223] = 1./3.*x[9]; - grad[224] = 0.0; - grad[225] = 0.0; - grad[226] = -4.0*x[10] - 2.66666666666667*x[11] + 2./3.*x[12] - 1.33333333333333*x[13] - 4.0; - grad[227] = 0.0; - grad[228] = 0.0; - grad[229] = 0.0; - grad[230] = 0.0; - grad[231] = 0.0; - grad[232] = 0.0; - grad[233] = 0.0; - grad[234] = -4.0*x[2]; - grad[235] = -2.66666666666667*x[2]; - grad[236] = 2./3.*x[2] + 2.0; - grad[237] = -1.33333333333333*x[2]; - grad[238] = 0.0; - grad[239] = 0.0; - grad[240] = 0.0; - grad[241] = -4.0*x[10] - 2.66666666666667*x[11] + 2./3.*x[12] - 1.33333333333333*x[13] - 4.0; - grad[242] = 0.0; - grad[243] = 0.0; - grad[244] = 0.0; - grad[245] = 0.0; - grad[246] = 0.0; - grad[247] = 0.0; - grad[248] = -4.0*x[3]; - grad[249] = -2.66666666666667*x[3]; - grad[250] = 2./3.*x[3]; - grad[251] = -1.33333333333333*x[3]; - grad[252] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[253] = 0.0; - grad[254] = 0.0; - grad[255] = 0.0; - grad[256] = 0.0; - grad[257] = 0.0; - grad[258] = 0.0; - grad[259] = 0.0; - grad[260] = 0.0; - grad[261] = 0.0; - grad[262] = 1.0 - x[0]; - grad[263] = -2./3.*x[0]; - grad[264] = 1./6.*x[0]; - grad[265] = -1./3.*x[0]; - grad[266] = 0.0; - grad[267] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[268] = 0.0; - grad[269] = 0.0; - grad[270] = 0.0; - grad[271] = 0.0; - grad[272] = 0.0; - grad[273] = 0.0; - grad[274] = 0.0; - grad[275] = 0.0; - grad[276] = 1.0 - x[1]; - grad[277] = -2./3.*x[1]; - grad[278] = 1./6.*x[1]; - grad[279] = -1./3.*x[1]; - grad[280] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[281] = -x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; - grad[282] = -4.0*x[10] - 2.66666666666667*x[11] + 2./3.*x[12] - 1.33333333333333*x[13] - 4.0; - grad[283] = -4.0*x[10] - 2.66666666666667*x[11] + 2./3.*x[12] - 1.33333333333333*x[13] - 4.0; - grad[284] = 0.0; - grad[285] = 0.0; - grad[286] = 0.0; - grad[287] = 0.0; - grad[288] = 0.0; - grad[289] = 0.0; - grad[290] = -x[0] - x[1] - 4.0*x[2] - 4.0*x[3] + 2.0; - grad[291] = -2./3.*x[0] - 2./3.*x[1] - 2.66666666666667*x[2] - 2.66666666666667*x[3]; - grad[292] = 1./6.*x[0] + 1./6.*x[1] + 2./3.*x[2] + 2./3.*x[3] + 2.0; - grad[293] = -1./3.*x[0] - 1./3.*x[1] - 1.33333333333333*x[2] - 1.33333333333333*x[3]; } return; -};
    +};
    + -
    [docs]/** - Inequality constraints for fl +
    [docs]/** + local minimization for epidote */ -void fl_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] + x[2] - 1.0); - result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -x[2]); - result[4] = ( eps_sf + x[2] - 1.0); +void ep_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0] + x[1]); + result[1] = ( eps_sf + x[0] - x[1] - 1.0); + result[2] = ( eps_sf + -x[0] - x[1]); + result[3] = ( eps_sf + x[0] + x[1] - 1.0); if (grad) { - grad[0] = 1.0; + grad[0] = -1.0; grad[1] = 1.0; grad[2] = 1.0; grad[3] = -1.0; - grad[4] = 0.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = -1.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = -1.0; - grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = 1.0; + grad[4] = -1.0; + grad[5] = -1.0; + grad[6] = 1.0; + grad[7] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for fsp + +
    [docs]/** + local minimization for fluid */ -void fsp_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -0.25*x[0] - 0.25); - result[4] = ( eps_sf + 0.25*x[0] - 0.75); +void fl_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[6] + x[3] + x[2] + x[9] + x[5] + x[4] + x[8] + x[1] + x[7] + x[0] - 1.0); + result[1] = ( eps_sf + -x[1]); + result[2] = ( eps_sf + -x[0]); + result[3] = ( eps_sf + -x[2]); + result[4] = ( eps_sf + -x[3]); + result[5] = ( eps_sf + -x[4]); + result[6] = ( eps_sf + -x[5]); + result[7] = ( eps_sf + -x[6]); + result[8] = ( eps_sf + -x[7]); + result[9] = ( eps_sf + -x[8]); + result[10] = ( eps_sf + -x[9]); + result[11] = ( eps_sf + x[9] - 1.0); if (grad) { grad[0] = 1.0; grad[1] = 1.0; - grad[2] = -1.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.0; - grad[6] = -0.2500; - grad[7] = 0.0; - grad[8] = 0.2500; - grad[9] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for spn -*/ -void spn_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 1./3.*x[0]*x[3] + 1./3.*x[0] - 1./3.*x[3] - 2./3.*x[4] - 1./3.); - result[1] = ( eps_sf + -1./3.*x[0]*x[3] - 1./3.*x[0] - 2./3.*x[5]); - result[2] = ( eps_sf + -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + 1./3.*x[3] + 2./3.*x[4] + 2./3.*x[5] + 2./3.*x[6] - 2./3.); - result[3] = ( eps_sf + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] - 2./3.*x[6]); - result[4] = ( eps_sf + 1./3.*x[0]*x[3] + 1./3.*x[0] - 1./3.*x[3] + 1./3.*x[4] - 1./3.); - result[5] = ( eps_sf + -1./3.*x[0]*x[3] - 1./3.*x[0] + 1./3.*x[5]); - result[6] = ( eps_sf + -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + x[2] + 0.833333333333333*x[3] - 1./3.*x[4] - 1./3.*x[5] - 1./3.*x[6] - 2./3.); - result[7] = ( eps_sf + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] + 1./3.*x[6]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -0.5*x[3]); - - if (grad) { - grad[0] = 1./3.*x[3] + 1./3.; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1./3.*x[0] - 1./3.; - grad[4] = -2./3.; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = -1./3.*x[3] - 1./3.; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = -1./3.*x[0]; - grad[11] = 0.0; - grad[12] = -2./3.; + grad[2] = 1.0; + grad[3] = 1.0; + grad[4] = 1.0; + grad[5] = 1.0; + grad[6] = 1.0; + grad[7] = 1.0; + grad[8] = 1.0; + grad[9] = 1.0; + grad[10] = 0.0; + grad[11] = -1.0; + grad[12] = 0.0; grad[13] = 0.0; grad[14] = 0.0; - grad[15] = -2./3.*x[2] - 2./3.*x[3] + 2./3.; - grad[16] = -2./3.*x[1]; - grad[17] = 1./3. - 2./3.*x[1]; - grad[18] = 2./3.; - grad[19] = 2./3.; - grad[20] = 2./3.; + grad[15] = 0.0; + grad[16] = 0.0; + grad[17] = 0.0; + grad[18] = 0.0; + grad[19] = 0.0; + grad[20] = -1.0; grad[21] = 0.0; - grad[22] = 2./3.*x[2] + 2./3.*x[3] - 2./3.; - grad[23] = 2./3.*x[1]; - grad[24] = 2./3.*x[1]; + grad[22] = 0.0; + grad[23] = 0.0; + grad[24] = 0.0; grad[25] = 0.0; grad[26] = 0.0; - grad[27] = -2./3.; - grad[28] = 1./3.*x[3] + 1./3.; + grad[27] = 0.0; + grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; - grad[31] = 1./3.*x[0] - 1./3.; - grad[32] = 1./3.; + grad[31] = 0.0; + grad[32] = -1.0; grad[33] = 0.0; grad[34] = 0.0; - grad[35] = -1./3.*x[3] - 1./3.; + grad[35] = 0.0; grad[36] = 0.0; grad[37] = 0.0; - grad[38] = -1./3.*x[0]; + grad[38] = 0.0; grad[39] = 0.0; - grad[40] = 1./3.; + grad[40] = 0.0; grad[41] = 0.0; grad[42] = 0.0; - grad[43] = -2./3.*x[2] - 2./3.*x[3] + 2./3.; - grad[44] = 1.0 - 2./3.*x[1]; - grad[45] = 0.833333333333333 - 2./3.*x[1]; - grad[46] = -1./3.; - grad[47] = -1./3.; - grad[48] = -1./3.; + grad[43] = -1.0; + grad[44] = 0.0; + grad[45] = 0.0; + grad[46] = 0.0; + grad[47] = 0.0; + grad[48] = 0.0; grad[49] = 0.0; - grad[50] = 2./3.*x[2] + 2./3.*x[3] - 2./3.; - grad[51] = 2./3.*x[1]; - grad[52] = 2./3.*x[1]; + grad[50] = 0.0; + grad[51] = 0.0; + grad[52] = 0.0; grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 1./3.; + grad[54] = -1.0; + grad[55] = 0.0; grad[56] = 0.0; grad[57] = 0.0; - grad[58] = -1.0; + grad[58] = 0.0; grad[59] = 0.0; grad[60] = 0.0; grad[61] = 0.0; grad[62] = 0.0; grad[63] = 0.0; grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -0.50; + grad[65] = -1.0; + grad[66] = 0.0; grad[67] = 0.0; grad[68] = 0.0; grad[69] = 0.0; + grad[70] = 0.0; + grad[71] = 0.0; + grad[72] = 0.0; + grad[73] = 0.0; + grad[74] = 0.0; + grad[75] = 0.0; + grad[76] = -1.0; + grad[77] = 0.0; + grad[78] = 0.0; + grad[79] = 0.0; + grad[80] = 0.0; + grad[81] = 0.0; + grad[82] = 0.0; + grad[83] = 0.0; + grad[84] = 0.0; + grad[85] = 0.0; + grad[86] = 0.0; + grad[87] = -1.0; + grad[88] = 0.0; + grad[89] = 0.0; + grad[90] = 0.0; + grad[91] = 0.0; + grad[92] = 0.0; + grad[93] = 0.0; + grad[94] = 0.0; + grad[95] = 0.0; + grad[96] = 0.0; + grad[97] = 0.0; + grad[98] = -1.0; + grad[99] = 0.0; + grad[100] = 0.0; + grad[101] = 0.0; + grad[102] = 0.0; + grad[103] = 0.0; + grad[104] = 0.0; + grad[105] = 0.0; + grad[106] = 0.0; + grad[107] = 0.0; + grad[108] = 0.0; + grad[109] = -1.0; + grad[110] = 0.0; + grad[111] = 0.0; + grad[112] = 0.0; + grad[113] = 0.0; + grad[114] = 0.0; + grad[115] = 0.0; + grad[116] = 0.0; + grad[117] = 0.0; + grad[118] = 0.0; + grad[119] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for g -*/ -void g_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[2] + x[3] + 2.0*x[4] - 1.0); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + -x[2]); - result[6] = ( eps_sf + -x[4]); - result[7] = ( eps_sf + -x[4]); + +
    [docs]/** + local minimization for garnet +*/ +void g_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); + result[1] = ( eps_sf + x[1]*x[0] - x[0]); + result[2] = ( eps_sf + -x[1]); + result[3] = ( eps_sf + x[3] + x[2] + 2.0*x[4] - 1.0); + result[4] = ( eps_sf + -x[3]); + result[5] = ( eps_sf + -x[2]); + result[6] = ( eps_sf + -x[4]); if (grad) { grad[0] = 1.0 - x[1]; @@ -2151,96 +1530,66 @@

    Source code for NLopt_opt_function.c

             grad[32] = 0.0;
             grad[33] = 0.0;
             grad[34] = -1.0;
    -        grad[35] = 0.0;
    -        grad[36] = 0.0;
    -        grad[37] = 0.0;
    -        grad[38] = 0.0;
    -        grad[39] = -1.0;
         }
     
         return;
     };
    -
    [docs]/** - Inequality constraints for ol -*/ -void ol_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - x[2] - 1.0); - result[1] = ( eps_sf + -x[0] + x[2]); - result[2] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] + x[2] - 1.0); - result[3] = ( eps_sf + x[0]*x[1] - x[0] - x[2]); - result[4] = ( eps_sf + -x[1]); - - if (grad) { - grad[0] = 1.0; - grad[1] = 0.0; - grad[2] = -1.0; - grad[3] = -1.0; - grad[4] = 0.0; - grad[5] = 1.0; - grad[6] = 1.0 - x[1]; - grad[7] = 1.0 - x[0]; - grad[8] = 1.0; - grad[9] = x[1] - 1.0; - grad[10] = x[0]; - grad[11] = -1.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - } - - return; -};
    -
    [docs]/** - Inequality constraints for opx +
    [docs]/** + local minimization for hornblende */ -void opx_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[1] + x[3]*x[5] - x[3]*x[7] + x[3] - x[5] + x[7] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] - x[0]*x[5] + x[0]*x[7] - x[0] + x[1]*x[3] - x[3]*x[5] + x[3]*x[7] - x[3]); - result[2] = ( eps_sf + -x[1] + x[4] + 2.0*x[5] + x[6] - x[7]); - result[3] = ( eps_sf + -x[4]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[5]); - result[6] = ( eps_sf + -x[0]*x[2] - x[0]*x[7] + x[0] + x[1]*x[3] + x[2] - x[3]*x[5] + x[3]*x[7] - x[3] + x[7] - 1.0); - result[7] = ( eps_sf + x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]); - result[8] = ( eps_sf + -x[2]); +void hb_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[3] - 1.0); + result[1] = ( eps_sf + x[3]*x[4] - x[3]); + result[2] = ( eps_sf + -x[3]*x[4]); + result[3] = ( eps_sf + -x[8] + x[0] - 1.0); + result[4] = ( eps_sf + x[8] - x[0]); + result[5] = ( eps_sf + x[9]*x[6] + x[9]*x[7] + x[9]*x[1] - x[9] - x[6]*x[0] + x[6] - x[7]*x[0] + x[7] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[6] = ( eps_sf + -x[9]*x[6] - x[9]*x[7] - x[9]*x[1] + x[9] + x[6]*x[0] + x[7]*x[0] + x[0]*x[1] - x[0]); + result[7] = ( eps_sf + -x[1]); + result[8] = ( eps_sf + -x[6]); result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + 0.5*x[1] - 1.0); - result[11] = ( eps_sf + -0.5*x[1]); + result[10] = ( eps_sf + -x[5]); + result[11] = ( eps_sf + 1.5*x[8] - x[9]*x[6] - x[9]*x[7] - x[9]*x[1] + x[9] - x[5]*x[0] + x[5] - x[0]*x[2] + x[0] + x[2] - 1.0); + result[12] = ( eps_sf + -1.5*x[8] + x[9]*x[6] + x[9]*x[7] + x[9]*x[1] - x[9] + x[5]*x[0] + x[0]*x[2] - x[0]); + result[13] = ( eps_sf + -x[2]); + result[14] = ( eps_sf + 0.25*x[3] + 0.5*x[6] + 0.5*x[7] + 0.5*x[1] - 0.5*x[2] - 1.0); + result[15] = ( eps_sf + -0.25*x[3] - 0.5*x[6] - 0.5*x[7] - 0.5*x[1] + 0.5*x[2]); + result[16] = ( eps_sf + x[7] - 1.0); if (grad) { - grad[0] = -x[1] + x[5] - x[7] + 1.0; - grad[1] = -x[0] - x[3] + 1.0; + grad[0] = 0.0; + grad[1] = 0.0; grad[2] = 0.0; - grad[3] = -x[1] + x[5] - x[7] + 1.0; + grad[3] = 1.0; grad[4] = 0.0; - grad[5] = x[0] + x[3] - 1.0; + grad[5] = 0.0; grad[6] = 0.0; - grad[7] = -x[0] - x[3] + 1.0; - grad[8] = x[1] - x[5] + x[7] - 1.0; - grad[9] = x[0] + x[3]; + grad[7] = 0.0; + grad[8] = 0.0; + grad[9] = 0.0; grad[10] = 0.0; - grad[11] = x[1] - x[5] + x[7] - 1.0; + grad[11] = 0.0; grad[12] = 0.0; - grad[13] = -x[0] - x[3]; - grad[14] = 0.0; - grad[15] = x[0] + x[3]; + grad[13] = x[4] - 1.0; + grad[14] = x[3]; + grad[15] = 0.0; grad[16] = 0.0; - grad[17] = -1.0; + grad[17] = 0.0; grad[18] = 0.0; grad[19] = 0.0; - grad[20] = 1.0; - grad[21] = 2.0; - grad[22] = 1.0; - grad[23] = -1.0; - grad[24] = 0.0; + grad[20] = 0.0; + grad[21] = 0.0; + grad[22] = 0.0; + grad[23] = -x[4]; + grad[24] = -x[3]; grad[25] = 0.0; grad[26] = 0.0; grad[27] = 0.0; - grad[28] = -1.0; + grad[28] = 0.0; grad[29] = 0.0; - grad[30] = 0.0; + grad[30] = 1.0; grad[31] = 0.0; grad[32] = 0.0; grad[33] = 0.0; @@ -2250,38 +1599,38 @@

    Source code for NLopt_opt_function.c

             grad[37] = 0.0;
             grad[38] = -1.0;
             grad[39] = 0.0;
    -        grad[40] = 0.0;
    +        grad[40] = -1.0;
             grad[41] = 0.0;
             grad[42] = 0.0;
             grad[43] = 0.0;
             grad[44] = 0.0;
    -        grad[45] = -1.0;
    +        grad[45] = 0.0;
             grad[46] = 0.0;
             grad[47] = 0.0;
    -        grad[48] = -x[2] - x[7] + 1.0;
    -        grad[49] = x[3];
    -        grad[50] = 1.0 - x[0];
    -        grad[51] = x[1] - x[5] + x[7] - 1.0;
    +        grad[48] = 1.0;
    +        grad[49] = 0.0;
    +        grad[50] = -x[6] - x[7] - x[1] + 1.0;
    +        grad[51] = x[9] - x[0] + 1.0;
             grad[52] = 0.0;
    -        grad[53] = -x[3];
    +        grad[53] = 0.0;
             grad[54] = 0.0;
    -        grad[55] = -x[0] + x[3] + 1.0;
    -        grad[56] = x[2] + x[7] - 1.0;
    -        grad[57] = -x[3];
    -        grad[58] = x[0];
    -        grad[59] = -x[1] + x[5] - x[7] + 1.0;
    -        grad[60] = 0.0;
    -        grad[61] = x[3];
    +        grad[55] = 0.0;
    +        grad[56] = x[9] - x[0] + 1.0;
    +        grad[57] = x[9] - x[0] + 1.0;
    +        grad[58] = 0.0;
    +        grad[59] = x[6] + x[7] + x[1] - 1.0;
    +        grad[60] = x[6] + x[7] + x[1] - 1.0;
    +        grad[61] = -x[9] + x[0];
             grad[62] = 0.0;
    -        grad[63] = x[0] - x[3];
    +        grad[63] = 0.0;
             grad[64] = 0.0;
             grad[65] = 0.0;
    -        grad[66] = -1.0;
    -        grad[67] = 0.0;
    +        grad[66] = -x[9] + x[0];
    +        grad[67] = -x[9] + x[0];
             grad[68] = 0.0;
    -        grad[69] = 0.0;
    +        grad[69] = -x[6] - x[7] - x[1] + 1.0;
             grad[70] = 0.0;
    -        grad[71] = 0.0;
    +        grad[71] = -1.0;
             grad[72] = 0.0;
             grad[73] = 0.0;
             grad[74] = 0.0;
    @@ -2289,134 +1638,14 @@ 

    Source code for NLopt_opt_function.c

             grad[76] = 0.0;
             grad[77] = 0.0;
             grad[78] = 0.0;
    -        grad[79] = -1.0;
    -        grad[80] = 0.0;
    -        grad[81] = 0.50;
    -        grad[82] = 0.0;
    -        grad[83] = 0.0;
    -        grad[84] = 0.0;
    -        grad[85] = 0.0;
    -        grad[86] = 0.0;
    -        grad[87] = 0.0;
    -        grad[88] = 0.0;
    -        grad[89] = -0.50;
    -        grad[90] = 0.0;
    -        grad[91] = 0.0;
    -        grad[92] = 0.0;
    -        grad[93] = 0.0;
    -        grad[94] = 0.0;
    -        grad[95] = 0.0;
    -    }
    -
    -    return;
    -};
    - -
    [docs]/** - Inequality constraints for cpx -*/ -void cpx_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] + x[1] - x[3]*x[4] + x[3] + x[4]*x[7] - x[4]*x[8] + x[4] - x[7] + x[8] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + x[1]*x[4] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]); - result[2] = ( eps_sf + -x[1] - x[3] + x[5] + x[6] + 2.0*x[7] - x[8]); - result[3] = ( eps_sf + -x[5]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[7]); - result[6] = ( eps_sf + x[0]*x[2] + x[1]*x[4] - x[2] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]); - result[7] = ( eps_sf + -x[0]*x[2] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]); - result[8] = ( eps_sf + x[2] + x[3] + x[8] - 1.0); - result[9] = ( eps_sf + -x[3]); - result[10] = ( eps_sf + -x[8]); - result[11] = ( eps_sf + 0.5*x[1] - 1.0); - result[12] = ( eps_sf + -0.5*x[1]); - - if (grad) { - grad[0] = -x[1] - x[3] + x[7] - x[8] + 1.0; - grad[1] = -x[0] - x[4] + 1.0; - grad[2] = 0.0; - grad[3] = -x[0] - x[4] + 1.0; - grad[4] = -x[1] - x[3] + x[7] - x[8] + 1.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = x[0] + x[4] - 1.0; - grad[8] = -x[0] - x[4] + 1.0; - grad[9] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[10] = x[0] + x[4]; - grad[11] = 0.0; - grad[12] = x[0] + x[4]; - grad[13] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = -x[0] - x[4]; - grad[17] = x[0] + x[4]; - grad[18] = 0.0; - grad[19] = -1.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 1.0; - grad[24] = 1.0; - grad[25] = 2.0; - grad[26] = -1.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = -1.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = -1.0; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = -1.0; - grad[53] = 0.0; - grad[54] = x[2]; - grad[55] = x[4]; - grad[56] = x[0] - 1.0; - grad[57] = x[4]; - grad[58] = x[1] + x[3] - x[7] + x[8] - 1.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = -x[4]; - grad[62] = x[4]; - grad[63] = -x[2]; - grad[64] = -x[4]; - grad[65] = -x[0]; - grad[66] = -x[4]; - grad[67] = -x[1] - x[3] + x[7] - x[8] + 1.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = x[4]; - grad[71] = -x[4]; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 1.0; - grad[75] = 1.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; grad[79] = 0.0; - grad[80] = 1.0; + grad[80] = 0.0; grad[81] = 0.0; grad[82] = 0.0; grad[83] = 0.0; - grad[84] = -1.0; + grad[84] = 0.0; grad[85] = 0.0; - grad[86] = 0.0; + grad[86] = -1.0; grad[87] = 0.0; grad[88] = 0.0; grad[89] = 0.0; @@ -2427,182 +1656,215 @@

    Source code for NLopt_opt_function.c

             grad[94] = 0.0;
             grad[95] = 0.0;
             grad[96] = 0.0;
    -        grad[97] = 0.0;
    -        grad[98] = -1.0;
    +        grad[97] = -1.0;
    +        grad[98] = 0.0;
             grad[99] = 0.0;
    -        grad[100] = 0.50;
    +        grad[100] = 0.0;
             grad[101] = 0.0;
             grad[102] = 0.0;
             grad[103] = 0.0;
             grad[104] = 0.0;
    -        grad[105] = 0.0;
    +        grad[105] = -1.0;
             grad[106] = 0.0;
             grad[107] = 0.0;
             grad[108] = 0.0;
    -        grad[109] = -0.50;
    -        grad[110] = 0.0;
    -        grad[111] = 0.0;
    -        grad[112] = 0.0;
    +        grad[109] = 0.0;
    +        grad[110] = -x[5] - x[2] + 1.0;
    +        grad[111] = -x[9];
    +        grad[112] = 1.0 - x[0];
             grad[113] = 0.0;
             grad[114] = 0.0;
    -        grad[115] = 0.0;
    -        grad[116] = 0.0;
    -    }
    -
    -    return;
    -};
    - -
    [docs]/** - Inequality constraints for ilm -*/ -void ilm_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] - 0.5*x[2]); - result[1] = ( eps_sf + -0.5*x[0] + 0.5*x[3]); - result[2] = ( eps_sf + x[0] - 1.0); - result[3] = ( eps_sf + -0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]); - result[4] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] + 0.5*x[2]); - result[5] = ( eps_sf + -0.5*x[0] - 0.5*x[3]); - result[6] = ( eps_sf + x[0] - 1.0); - result[7] = ( eps_sf + -0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]); + grad[115] = 1.0 - x[0]; + grad[116] = -x[9]; + grad[117] = -x[9]; + grad[118] = 1.50; + grad[119] = -x[6] - x[7] - x[1] + 1.0; + grad[120] = x[5] + x[2] - 1.0; + grad[121] = x[9]; + grad[122] = x[0]; + grad[123] = 0.0; + grad[124] = 0.0; + grad[125] = x[0]; + grad[126] = x[9]; + grad[127] = x[9]; + grad[128] = -1.50; + grad[129] = x[6] + x[7] + x[1] - 1.0; + grad[130] = 0.0; + grad[131] = 0.0; + grad[132] = -1.0; + grad[133] = 0.0; + grad[134] = 0.0; + grad[135] = 0.0; + grad[136] = 0.0; + grad[137] = 0.0; + grad[138] = 0.0; + grad[139] = 0.0; + grad[140] = 0.0; + grad[141] = 0.50; + grad[142] = -0.50; + grad[143] = 0.250; + grad[144] = 0.0; + grad[145] = 0.0; + grad[146] = 0.50; + grad[147] = 0.50; + grad[148] = 0.0; + grad[149] = 0.0; + grad[150] = 0.0; + grad[151] = -0.50; + grad[152] = 0.50; + grad[153] = -0.250; + grad[154] = 0.0; + grad[155] = 0.0; + grad[156] = -0.50; + grad[157] = -0.50; + grad[158] = 0.0; + grad[159] = 0.0; + grad[160] = 0.0; + grad[161] = 0.0; + grad[162] = 0.0; + grad[163] = 0.0; + grad[164] = 0.0; + grad[165] = 0.0; + grad[166] = 0.0; + grad[167] = 1.0; + grad[168] = 0.0; + grad[169] = 0.0; + } + + return; +};
    + + +
    [docs]/** + local minimization for ilmenite +*/ +void ilm_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -0.5*x[0] - 0.5*x[1]); + result[1] = ( eps_sf + -0.5*x[0] + 0.5*x[1]); + result[2] = ( eps_sf + x[0] - 1.0); + result[3] = ( eps_sf + -0.5*x[0] + 0.5*x[1]); + result[4] = ( eps_sf + -0.5*x[0] - 0.5*x[1]); + result[5] = ( eps_sf + x[0] - 1.0); if (grad) { - grad[0] = 0.5*x[1] - 0.5; - grad[1] = 0.5*x[0]; + grad[0] = -0.50; + grad[1] = -0.50; grad[2] = -0.50; - grad[3] = 0.0; - grad[4] = -0.50; + grad[3] = 0.50; + grad[4] = 1.0; grad[5] = 0.0; - grad[6] = 0.0; + grad[6] = -0.50; grad[7] = 0.50; - grad[8] = 1.0; - grad[9] = 0.0; - grad[10] = 0.0; + grad[8] = -0.50; + grad[9] = -0.50; + grad[10] = 1.0; grad[11] = 0.0; - grad[12] = -0.5*x[1]; - grad[13] = -0.5*x[0]; - grad[14] = 0.50; - grad[15] = -0.50; - grad[16] = 0.5*x[1] - 0.5; - grad[17] = 0.5*x[0]; - grad[18] = 0.50; - grad[19] = 0.0; - grad[20] = -0.50; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -0.50; - grad[24] = 1.0; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = -0.5*x[1]; - grad[29] = -0.5*x[0]; - grad[30] = -0.50; - grad[31] = 0.50; } return; };
    -
    [docs]/** - Inequality constraints for hb + +
    [docs]/** + local minimization for liquid (melt) */ -void hb_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[3] - 1.0); - result[1] = ( eps_sf + x[3]*x[4] - x[3]); - result[2] = ( eps_sf + -x[3]*x[4]); - result[3] = ( eps_sf + x[0] - x[8] - 1.0); - result[4] = ( eps_sf + -x[0] + x[8]); - result[5] = ( eps_sf + -x[0]*x[1] - x[0]*x[6] - x[0]*x[7] + x[0] + x[1]*x[9] + x[1] + x[6]*x[9] + x[6] + x[7]*x[9] + x[7] - x[9] - 1.0); - result[6] = ( eps_sf + x[0]*x[1] + x[0]*x[6] + x[0]*x[7] - x[0] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + x[9]); - result[7] = ( eps_sf + -x[1]); - result[8] = ( eps_sf + -x[6]); - result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + -x[5]); - result[11] = ( eps_sf + -x[0]*x[2] - x[0]*x[5] + x[0] - x[1]*x[9] + x[2] + x[5] - x[6]*x[9] - x[7]*x[9] + 1.5*x[8] + x[9] - 1.0); - result[12] = ( eps_sf + x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9]); - result[13] = ( eps_sf + -x[2]); - result[14] = ( eps_sf + 0.5*x[1] - 0.5*x[2] + 0.25*x[3] + 0.5*x[6] + 0.5*x[7] - 1.0); - result[15] = ( eps_sf + -0.5*x[1] + 0.5*x[2] - 0.25*x[3] - 0.5*x[6] - 0.5*x[7]); - result[16] = ( eps_sf + x[7] - 1.0); - result[17] = ( eps_sf + -x[7]); +void liq_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[6] + x[3] + x[2] + x[10] + x[5] + x[4] + x[8] + x[1] + x[7] + x[0] - 0.25*x[9]*(-3.0*x[6] - 3.0*x[3] - 3.0*x[2] - 3.0*x[10] - 3.0*x[5] - 3.0*x[4] - 3.0*x[8] - 3.0*x[1] - 3.0*x[7] - 3.0*x[0] + 4.0) - 1.0); + result[1] = ( eps_sf + -0.75*x[1]*x[9] - x[1] + x[9]); + result[2] = ( eps_sf + -0.75*x[0]*x[9] - x[0] + x[9]); + result[3] = ( eps_sf + -0.75*x[4]*x[9] - x[4]); + result[4] = ( eps_sf + -0.75*x[5]*x[9] - x[5]); + result[5] = ( eps_sf + -0.75*x[6]*x[9] - x[6]); + result[6] = ( eps_sf + -0.75*x[7]*x[9] - x[7]); + result[7] = ( eps_sf + -0.75*x[8]*x[9] - x[8]); + result[8] = ( eps_sf + -x[9]); + result[9] = ( eps_sf + -x[3] - x[2] - 0.75*x[9]*(x[3] + x[2])); + result[10] = ( eps_sf + 0.75*x[10]*x[9] + x[10] - 1.0); + result[11] = ( eps_sf + -4.0*x[2]); + result[12] = ( eps_sf + -4.0*x[3]); + result[13] = ( eps_sf + -x[0]); + result[14] = ( eps_sf + -x[1]); + result[15] = ( eps_sf + -4.0*x[3] - 4.0*x[2] - x[1] - x[0]); + result[16] = ( eps_sf + -x[10]); + result[17] = ( eps_sf + x[10] - 1.0); if (grad) { - grad[0] = 0.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 0.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; + grad[0] = 0.75*x[9] + 1.0; + grad[1] = 0.75*x[9] + 1.0; + grad[2] = 0.75*x[9] + 1.0; + grad[3] = 0.75*x[9] + 1.0; + grad[4] = 0.75*x[9] + 1.0; + grad[5] = 0.75*x[9] + 1.0; + grad[6] = 0.75*x[9] + 1.0; + grad[7] = 0.75*x[9] + 1.0; + grad[8] = 0.75*x[9] + 1.0; + grad[9] = 0.75*x[6] + 0.75*x[3] + 0.75*x[2] + 0.75*x[10] + 0.75*x[5] + 0.75*x[4] + 0.75*x[8] + 0.75*x[1] + 0.75*x[7] + 0.75*x[0] - 1.0; + grad[10] = 0.75*x[9] + 1.0; grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = x[4] - 1.0; - grad[14] = x[3]; + grad[12] = -0.75*x[9] - 1.0; + grad[13] = 0.0; + grad[14] = 0.0; grad[15] = 0.0; grad[16] = 0.0; grad[17] = 0.0; grad[18] = 0.0; grad[19] = 0.0; - grad[20] = 0.0; + grad[20] = 1.0 - 0.75*x[1]; grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -x[4]; - grad[24] = -x[3]; + grad[22] = -0.75*x[9] - 1.0; + grad[23] = 0.0; + grad[24] = 0.0; grad[25] = 0.0; grad[26] = 0.0; grad[27] = 0.0; grad[28] = 0.0; grad[29] = 0.0; - grad[30] = 1.0; - grad[31] = 0.0; + grad[30] = 0.0; + grad[31] = 1.0 - 0.75*x[0]; grad[32] = 0.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.0; + grad[37] = -0.75*x[9] - 1.0; + grad[38] = 0.0; grad[39] = 0.0; - grad[40] = -1.0; + grad[40] = 0.0; grad[41] = 0.0; - grad[42] = 0.0; + grad[42] = -0.75*x[4]; grad[43] = 0.0; grad[44] = 0.0; grad[45] = 0.0; grad[46] = 0.0; grad[47] = 0.0; - grad[48] = 1.0; - grad[49] = 0.0; - grad[50] = -x[1] - x[6] - x[7] + 1.0; - grad[51] = -x[0] + x[9] + 1.0; + grad[48] = 0.0; + grad[49] = -0.75*x[9] - 1.0; + grad[50] = 0.0; + grad[51] = 0.0; grad[52] = 0.0; - grad[53] = 0.0; + grad[53] = -0.75*x[5]; grad[54] = 0.0; grad[55] = 0.0; - grad[56] = -x[0] + x[9] + 1.0; - grad[57] = -x[0] + x[9] + 1.0; + grad[56] = 0.0; + grad[57] = 0.0; grad[58] = 0.0; - grad[59] = x[1] + x[6] + x[7] - 1.0; - grad[60] = x[1] + x[6] + x[7] - 1.0; - grad[61] = x[0] - x[9]; + grad[59] = 0.0; + grad[60] = 0.0; + grad[61] = -0.75*x[9] - 1.0; grad[62] = 0.0; grad[63] = 0.0; - grad[64] = 0.0; + grad[64] = -0.75*x[6]; grad[65] = 0.0; - grad[66] = x[0] - x[9]; - grad[67] = x[0] - x[9]; + grad[66] = 0.0; + grad[67] = 0.0; grad[68] = 0.0; - grad[69] = -x[1] - x[6] - x[7] + 1.0; + grad[69] = 0.0; grad[70] = 0.0; - grad[71] = -1.0; + grad[71] = 0.0; grad[72] = 0.0; - grad[73] = 0.0; + grad[73] = -0.75*x[9] - 1.0; grad[74] = 0.0; - grad[75] = 0.0; + grad[75] = -0.75*x[7]; grad[76] = 0.0; grad[77] = 0.0; grad[78] = 0.0; @@ -2612,8 +1874,8 @@

    Source code for NLopt_opt_function.c

             grad[82] = 0.0;
             grad[83] = 0.0;
             grad[84] = 0.0;
    -        grad[85] = 0.0;
    -        grad[86] = -1.0;
    +        grad[85] = -0.75*x[9] - 1.0;
    +        grad[86] = -0.75*x[8];
             grad[87] = 0.0;
             grad[88] = 0.0;
             grad[89] = 0.0;
    @@ -2628,63 +1890,63 @@ 

    Source code for NLopt_opt_function.c

             grad[98] = 0.0;
             grad[99] = 0.0;
             grad[100] = 0.0;
    -        grad[101] = 0.0;
    -        grad[102] = 0.0;
    +        grad[101] = -0.75*x[9] - 1.0;
    +        grad[102] = -0.75*x[9] - 1.0;
             grad[103] = 0.0;
             grad[104] = 0.0;
    -        grad[105] = -1.0;
    +        grad[105] = 0.0;
             grad[106] = 0.0;
             grad[107] = 0.0;
    -        grad[108] = 0.0;
    +        grad[108] = -0.75*x[3] - 0.75*x[2];
             grad[109] = 0.0;
    -        grad[110] = -x[2] - x[5] + 1.0;
    -        grad[111] = -x[9];
    -        grad[112] = 1.0 - x[0];
    +        grad[110] = 0.0;
    +        grad[111] = 0.0;
    +        grad[112] = 0.0;
             grad[113] = 0.0;
             grad[114] = 0.0;
    -        grad[115] = 1.0 - x[0];
    -        grad[116] = -x[9];
    -        grad[117] = -x[9];
    -        grad[118] = 1.500;
    -        grad[119] = -x[1] - x[6] - x[7] + 1.0;
    -        grad[120] = x[2] + x[5] - 1.0;
    -        grad[121] = x[9];
    -        grad[122] = x[0];
    -        grad[123] = 0.0;
    +        grad[115] = 0.0;
    +        grad[116] = 0.0;
    +        grad[117] = 0.0;
    +        grad[118] = 0.0;
    +        grad[119] = 0.75*x[10];
    +        grad[120] = 0.75*x[9] + 1.0;
    +        grad[121] = 0.0;
    +        grad[122] = 0.0;
    +        grad[123] = -4.0;
             grad[124] = 0.0;
    -        grad[125] = x[0];
    -        grad[126] = x[9];
    -        grad[127] = x[9];
    -        grad[128] = -1.500;
    -        grad[129] = x[1] + x[6] + x[7] - 1.0;
    +        grad[125] = 0.0;
    +        grad[126] = 0.0;
    +        grad[127] = 0.0;
    +        grad[128] = 0.0;
    +        grad[129] = 0.0;
             grad[130] = 0.0;
             grad[131] = 0.0;
    -        grad[132] = -1.0;
    +        grad[132] = 0.0;
             grad[133] = 0.0;
             grad[134] = 0.0;
    -        grad[135] = 0.0;
    +        grad[135] = -4.0;
             grad[136] = 0.0;
             grad[137] = 0.0;
             grad[138] = 0.0;
             grad[139] = 0.0;
             grad[140] = 0.0;
    -        grad[141] = 0.50;
    -        grad[142] = -0.50;
    -        grad[143] = 0.2500;
    +        grad[141] = 0.0;
    +        grad[142] = 0.0;
    +        grad[143] = -1.0;
             grad[144] = 0.0;
             grad[145] = 0.0;
    -        grad[146] = 0.50;
    -        grad[147] = 0.50;
    +        grad[146] = 0.0;
    +        grad[147] = 0.0;
             grad[148] = 0.0;
             grad[149] = 0.0;
             grad[150] = 0.0;
    -        grad[151] = -0.50;
    -        grad[152] = 0.50;
    -        grad[153] = -0.2500;
    +        grad[151] = 0.0;
    +        grad[152] = 0.0;
    +        grad[153] = 0.0;
             grad[154] = 0.0;
    -        grad[155] = 0.0;
    -        grad[156] = -0.50;
    -        grad[157] = -0.50;
    +        grad[155] = -1.0;
    +        grad[156] = 0.0;
    +        grad[157] = 0.0;
             grad[158] = 0.0;
             grad[159] = 0.0;
             grad[160] = 0.0;
    @@ -2692,10 +1954,10 @@ 

    Source code for NLopt_opt_function.c

             grad[162] = 0.0;
             grad[163] = 0.0;
             grad[164] = 0.0;
    -        grad[165] = 0.0;
    -        grad[166] = 0.0;
    -        grad[167] = 1.0;
    -        grad[168] = 0.0;
    +        grad[165] = -1.0;
    +        grad[166] = -1.0;
    +        grad[167] = -4.0;
    +        grad[168] = -4.0;
             grad[169] = 0.0;
             grad[170] = 0.0;
             grad[171] = 0.0;
    @@ -2704,3977 +1966,847 @@ 

    Source code for NLopt_opt_function.c

             grad[174] = 0.0;
             grad[175] = 0.0;
             grad[176] = 0.0;
    -        grad[177] = -1.0;
    +        grad[177] = 0.0;
             grad[178] = 0.0;
             grad[179] = 0.0;
    +        grad[180] = 0.0;
    +        grad[181] = 0.0;
    +        grad[182] = 0.0;
    +        grad[183] = 0.0;
    +        grad[184] = 0.0;
    +        grad[185] = 0.0;
    +        grad[186] = -1.0;
    +        grad[187] = 0.0;
    +        grad[188] = 0.0;
    +        grad[189] = 0.0;
    +        grad[190] = 0.0;
    +        grad[191] = 0.0;
    +        grad[192] = 0.0;
    +        grad[193] = 0.0;
    +        grad[194] = 0.0;
    +        grad[195] = 0.0;
    +        grad[196] = 0.0;
    +        grad[197] = 1.0;
         }
     
         return;
     };
    -
    [docs]/** - Inequality constraints for bi + +
    [docs]/** + local minimization for olivine */ -void bi_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[0] + x[1] + x[2] + x[3] + 2./3.*x[4] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - 2./3.*x[4]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[3]); +void ol_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[2] + x[0] - 1.0); + result[1] = ( eps_sf + x[2] - x[0]); + result[2] = ( eps_sf + -x[1]*x[0] + x[1] + x[2] + x[0] - 1.0); + result[3] = ( eps_sf + x[1]*x[0] - x[2] - x[0]); result[4] = ( eps_sf + -x[1]); - result[5] = ( eps_sf + x[0] - 1./3.*x[4] - 1.0); - result[6] = ( eps_sf + -x[0] + 1./3.*x[4]); - result[7] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 0.5); - result[8] = ( eps_sf + -0.5*x[1] - 0.5*x[2] - 0.5); - result[9] = ( eps_sf + x[3] - 1.0); - result[10] = ( eps_sf + -x[3]); if (grad) { - grad[0] = -x[1] - x[2] - x[3] + 1.0; - grad[1] = 1.0 - x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = 1.0 - x[0]; - grad[4] = 2./3.; - grad[5] = x[1] + x[2] + x[3] - 1.0; - grad[6] = x[0]; - grad[7] = x[0]; - grad[8] = x[0]; - grad[9] = -2./3.; + grad[0] = 1.0; + grad[1] = 0.0; + grad[2] = -1.0; + grad[3] = -1.0; + grad[4] = 0.0; + grad[5] = 1.0; + grad[6] = 1.0 - x[1]; + grad[7] = 1.0 - x[0]; + grad[8] = 1.0; + grad[9] = x[1] - 1.0; + grad[10] = x[0]; + grad[11] = -1.0; + grad[12] = 0.0; + grad[13] = -1.0; + grad[14] = 0.0; + } + + return; +};
    + + +
    [docs]/** + local minimization for orthopyroxene +*/ +void opx_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[7]*x[3] - x[7]*x[0] + x[7] + x[3]*x[5] - x[3]*x[1] + x[3] + x[5]*x[0] - x[5] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + x[7]*x[3] + x[7]*x[0] - x[3]*x[5] + x[3]*x[1] - x[3] - x[5]*x[0] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf + x[6] + x[4] - x[7] + 2.0*x[5] - x[1]); + result[3] = ( eps_sf + -x[4]); + result[4] = ( eps_sf + -x[6]); + result[5] = ( eps_sf + -x[5]); + result[6] = ( eps_sf + -x[2]*x[0] + x[2] + x[7]*x[3] - x[7]*x[0] + x[7] - x[3]*x[5] + x[3]*x[1] - x[3] + x[0] - 1.0); + result[7] = ( eps_sf + x[2]*x[0] - x[7]*x[3] + x[7]*x[0] + x[3]*x[5] - x[3]*x[1] + x[3] - x[0]); + result[8] = ( eps_sf + -x[2]); + result[9] = ( eps_sf + -x[7]); + result[10] = ( eps_sf + 0.5*x[1] - 1.0); + result[11] = ( eps_sf + -0.5*x[1]); + + if (grad) { + grad[0] = -x[7] + x[5] - x[1] + 1.0; + grad[1] = -x[3] - x[0] + 1.0; + grad[2] = 0.0; + grad[3] = -x[7] + x[5] - x[1] + 1.0; + grad[4] = 0.0; + grad[5] = x[3] + x[0] - 1.0; + grad[6] = 0.0; + grad[7] = -x[3] - x[0] + 1.0; + grad[8] = x[7] - x[5] + x[1] - 1.0; + grad[9] = x[3] + x[0]; grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = -1.0; - grad[13] = 0.0; + grad[11] = x[7] - x[5] + x[1] - 1.0; + grad[12] = 0.0; + grad[13] = -x[3] - x[0]; grad[14] = 0.0; - grad[15] = 0.0; + grad[15] = x[3] + x[0]; grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = -1.0; + grad[17] = -1.0; + grad[18] = 0.0; grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 0.0; + grad[20] = 1.0; + grad[21] = 2.0; + grad[22] = 1.0; + grad[23] = -1.0; grad[24] = 0.0; - grad[25] = 1.0; + grad[25] = 0.0; grad[26] = 0.0; grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = -1./3.; - grad[30] = -1.0; + grad[28] = -1.0; + grad[29] = 0.0; + grad[30] = 0.0; grad[31] = 0.0; grad[32] = 0.0; grad[33] = 0.0; - grad[34] = 1./3.; + grad[34] = 0.0; grad[35] = 0.0; - grad[36] = 0.50; - grad[37] = 0.50; - grad[38] = 0.0; + grad[36] = 0.0; + grad[37] = 0.0; + grad[38] = -1.0; grad[39] = 0.0; grad[40] = 0.0; - grad[41] = -0.50; - grad[42] = -0.50; + grad[41] = 0.0; + grad[42] = 0.0; grad[43] = 0.0; grad[44] = 0.0; - grad[45] = 0.0; + grad[45] = -1.0; grad[46] = 0.0; grad[47] = 0.0; - grad[48] = 1.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; + grad[48] = -x[2] - x[7] + 1.0; + grad[49] = x[3]; + grad[50] = 1.0 - x[0]; + grad[51] = x[7] - x[5] + x[1] - 1.0; grad[52] = 0.0; - grad[53] = -1.0; + grad[53] = -x[3]; grad[54] = 0.0; + grad[55] = x[3] - x[0] + 1.0; + grad[56] = x[2] + x[7] - 1.0; + grad[57] = -x[3]; + grad[58] = x[0]; + grad[59] = -x[7] + x[5] - x[1] + 1.0; + grad[60] = 0.0; + grad[61] = x[3]; + grad[62] = 0.0; + grad[63] = -x[3] + x[0]; + grad[64] = 0.0; + grad[65] = 0.0; + grad[66] = -1.0; + grad[67] = 0.0; + grad[68] = 0.0; + grad[69] = 0.0; + grad[70] = 0.0; + grad[71] = 0.0; + grad[72] = 0.0; + grad[73] = 0.0; + grad[74] = 0.0; + grad[75] = 0.0; + grad[76] = 0.0; + grad[77] = 0.0; + grad[78] = 0.0; + grad[79] = -1.0; + grad[80] = 0.0; + grad[81] = 0.50; + grad[82] = 0.0; + grad[83] = 0.0; + grad[84] = 0.0; + grad[85] = 0.0; + grad[86] = 0.0; + grad[87] = 0.0; + grad[88] = 0.0; + grad[89] = -0.50; + grad[90] = 0.0; + grad[91] = 0.0; + grad[92] = 0.0; + grad[93] = 0.0; + grad[94] = 0.0; + grad[95] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for ep -*/ -void ep_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0] + x[1]); - result[1] = ( eps_sf + x[0] - x[1] - 1.0); - result[2] = ( eps_sf + -x[0] - x[1]); - result[3] = ( eps_sf + x[0] + x[1] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 1.0; - grad[2] = 1.0; - grad[3] = -1.0; - grad[4] = -1.0; - grad[5] = -1.0; - grad[6] = 1.0; - grad[7] = 1.0; - } - - return; -};
    -
    [docs]/** - Inequality constraints for cd +
    [docs]/** + local minimization for felsdpar */ -void cd_igd_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); +void pl4T_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + -x[0]); result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[1] - 1.0); + result[3] = ( eps_sf + -0.25*x[0] - 0.25); + result[4] = ( eps_sf + 0.25*x[0] - 0.75); if (grad) { - grad[0] = -1.0; - grad[1] = 0.0; - grad[2] = 1.0; + grad[0] = 1.0; + grad[1] = 1.0; + grad[2] = -1.0; grad[3] = 0.0; grad[4] = 0.0; grad[5] = -1.0; - grad[6] = 0.0; - grad[7] = 1.0; + grad[6] = -0.250; + grad[7] = 0.0; + grad[8] = 0.250; + grad[9] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for liq_mp +
    [docs]/** + local minimization for spinel */ -void liq_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[6] - 1.0); - result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]*x[2]); - result[3] = ( eps_sf + -x[1]*(1.0 - x[2])); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + x[3] + x[1] + x[6] + x[4] + x[0] - 1.0); - result[6] = ( eps_sf + -x[4]); - result[7] = ( eps_sf + -x[5]); - result[8] = ( eps_sf + x[5] - 1.0); - result[9] = ( eps_sf + -x[6]); +void spn_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *SS_ref_db){ + SS_ref *d = (SS_ref *) SS_ref_db; + + result[0] = ( eps_sf + -2.0/3.0*x[4] + 1.0/3.0*x[3]*x[0] - 1.0/3.0*x[3] + 1.0/3.0*x[0] - 1.0/3.0); + result[1] = ( eps_sf + -2.0/3.0*x[5] - 1.0/3.0*x[3]*x[0] - 1.0/3.0*x[0]); + result[2] = ( eps_sf + 2.0/3.0*x[4] + 2.0/3.0*x[5] + 2.0/3.0*x[6] - 2.0/3.0*x[2]*x[1] - 2.0/3.0*x[3]*x[1] + 1.0/3.0*x[3] + 2.0/3.0*x[1] - 2.0/3.0); + result[3] = ( eps_sf + -2.0/3.0*x[6] + 2.0/3.0*x[2]*x[1] + 2.0/3.0*x[3]*x[1] - 2.0/3.0*x[1]); + result[4] = ( eps_sf + 1.0/3.0*x[4] + 1.0/3.0*x[3]*x[0] - 1.0/3.0*x[3] + 1.0/3.0*x[0] - 1.0/3.0); + result[5] = ( eps_sf + 1.0/3.0*x[5] - 1.0/3.0*x[3]*x[0] - 1.0/3.0*x[0]); + result[6] = ( eps_sf + -1.0/3.0*x[4] - 1.0/3.0*x[5] - 1.0/3.0*x[6] - 2.0/3.0*x[2]*x[1] + x[2] - 2.0/3.0*x[3]*x[1] + 5.0/6.0*x[3] + 2.0/3.0*x[1] - 2.0/3.0); + result[7] = ( eps_sf + 1.0/3.0*x[6] + 2.0/3.0*x[2]*x[1] + 2.0/3.0*x[3]*x[1] - 2.0/3.0*x[1]); + result[8] = ( eps_sf + -x[2]); + result[9] = ( eps_sf + -0.5*x[3]); if (grad) { - grad[0] = 0.0; + grad[0] = 1.0/3.0*x[3] + 1.0/3.0; grad[1] = 0.0; grad[2] = 0.0; - grad[3] = 0.0; - grad[4] = 0.0; + grad[3] = 1.0/3.0*x[0] - 1.0/3.0; + grad[4] = -2.0/3.0; grad[5] = 0.0; - grad[6] = 1.0; - grad[7] = -1.0; + grad[6] = 0.0; + grad[7] = -1.0/3.0*x[3] - 1.0/3.0; grad[8] = 0.0; grad[9] = 0.0; - grad[10] = 0.0; + grad[10] = -1.0/3.0*x[0]; grad[11] = 0.0; - grad[12] = 0.0; + grad[12] = -2.0/3.0; grad[13] = 0.0; grad[14] = 0.0; - grad[15] = -x[2]; - grad[16] = -x[1]; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 0.0; + grad[15] = -2.0/3.0*x[2] - 2.0/3.0*x[3] + 2.0/3.0; + grad[16] = -2.0/3.0*x[1]; + grad[17] = 1.0/3.0 - 2.0/3.0*x[1]; + grad[18] = 2.0/3.0; + grad[19] = 2.0/3.0; + grad[20] = 2.0/3.0; grad[21] = 0.0; - grad[22] = x[2] - 1.0; - grad[23] = x[1]; - grad[24] = 0.0; + grad[22] = 2.0/3.0*x[2] + 2.0/3.0*x[3] - 2.0/3.0; + grad[23] = 2.0/3.0*x[1]; + grad[24] = 2.0/3.0*x[1]; grad[25] = 0.0; grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; + grad[27] = -2.0/3.0; + grad[28] = 1.0/3.0*x[3] + 1.0/3.0; grad[29] = 0.0; grad[30] = 0.0; - grad[31] = -1.0; - grad[32] = 0.0; + grad[31] = 1.0/3.0*x[0] - 1.0/3.0; + grad[32] = 1.0/3.0; grad[33] = 0.0; grad[34] = 0.0; - grad[35] = 1.0; - grad[36] = 1.0; + grad[35] = -1.0/3.0*x[3] - 1.0/3.0; + grad[36] = 0.0; grad[37] = 0.0; - grad[38] = 1.0; - grad[39] = 1.0; - grad[40] = 0.0; - grad[41] = 1.0; + grad[38] = -1.0/3.0*x[0]; + grad[39] = 0.0; + grad[40] = 1.0/3.0; + grad[41] = 0.0; grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = -1.0; - grad[47] = 0.0; - grad[48] = 0.0; + grad[43] = -2.0/3.0*x[2] - 2.0/3.0*x[3] + 2.0/3.0; + grad[44] = 1.0 - 2.0/3.0*x[1]; + grad[45] = 5.0/6.0 - 2.0/3.0*x[1]; + grad[46] = -1.0/3.0; + grad[47] = -1.0/3.0; + grad[48] = -1.0/3.0; grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; + grad[50] = 2.0/3.0*x[2] + 2.0/3.0*x[3] - 2.0/3.0; + grad[51] = 2.0/3.0*x[1]; + grad[52] = 2.0/3.0*x[1]; grad[53] = 0.0; - grad[54] = -1.0; - grad[55] = 0.0; + grad[54] = 0.0; + grad[55] = 1.0/3.0; grad[56] = 0.0; grad[57] = 0.0; - grad[58] = 0.0; + grad[58] = -1.0; grad[59] = 0.0; grad[60] = 0.0; - grad[61] = 1.0; + grad[61] = 0.0; grad[62] = 0.0; grad[63] = 0.0; grad[64] = 0.0; grad[65] = 0.0; - grad[66] = 0.0; + grad[66] = -0.50; grad[67] = 0.0; grad[68] = 0.0; - grad[69] = -1.0; + grad[69] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for st_mp +
    [docs]/** + local minimization for biotite */ -void st_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); - result[1] = ( eps_sf + x[1]*x[0] - x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[2] + 1.33333333333333*x[3] - 1.0); - result[4] = ( eps_sf + -x[2]); - result[5] = ( eps_sf + -x[3]); - result[6] = ( eps_sf + -1./3.*x[3]); +void bi_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[2]*x[0] + x[2] + 2.0/3.0*x[4] - x[3]*x[0] + x[3] - x[0]*x[1] + x[0] + x[1] - 1.0); + result[1] = ( eps_sf + x[2]*x[0] - 2.0/3.0*x[4] + x[3]*x[0] + x[0]*x[1] - x[0]); + result[2] = ( eps_sf + -x[2]); + result[3] = ( eps_sf + -x[3]); + result[4] = ( eps_sf + -x[1]); + result[5] = ( eps_sf + -1.0/3.0*x[4] + x[0] - 1.0); + result[6] = ( eps_sf + 1.0/3.0*x[4] - x[0]); + result[7] = ( eps_sf + 0.5*x[2] + 0.5*x[1] - 0.5); + result[8] = ( eps_sf + -0.5*x[2] - 0.5*x[1] - 0.5); + result[9] = ( eps_sf + x[3] - 1.0); + result[10] = ( eps_sf + -x[3]); if (grad) { - grad[0] = 1.0 - x[1]; + grad[0] = -x[2] - x[3] - x[1] + 1.0; grad[1] = 1.0 - x[0]; - grad[2] = 0.0; - grad[3] = 0.0; - grad[4] = x[1] - 1.0; - grad[5] = x[0]; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = 0.0; - grad[9] = -1.0; + grad[2] = 1.0 - x[0]; + grad[3] = 1.0 - x[0]; + grad[4] = 2.0/3.0; + grad[5] = x[2] + x[3] + x[1] - 1.0; + grad[6] = x[0]; + grad[7] = x[0]; + grad[8] = x[0]; + grad[9] = -2.0/3.0; grad[10] = 0.0; grad[11] = 0.0; - grad[12] = 0.0; + grad[12] = -1.0; grad[13] = 0.0; - grad[14] = 1.0; - grad[15] = 1.33333333333333; + grad[14] = 0.0; + grad[15] = 0.0; grad[16] = 0.0; grad[17] = 0.0; grad[18] = -1.0; grad[19] = 0.0; grad[20] = 0.0; - grad[21] = 0.0; + grad[21] = -1.0; grad[22] = 0.0; - grad[23] = -1.0; + grad[23] = 0.0; grad[24] = 0.0; - grad[25] = 0.0; + grad[25] = 1.0; grad[26] = 0.0; - grad[27] = -1./3.; + grad[27] = 0.0; + grad[28] = 0.0; + grad[29] = -1.0/3.0; + grad[30] = -1.0; + grad[31] = 0.0; + grad[32] = 0.0; + grad[33] = 0.0; + grad[34] = 1.0/3.0; + grad[35] = 0.0; + grad[36] = 0.5; + grad[37] = 0.5; + grad[38] = 0.0; + grad[39] = 0.0; + grad[40] = 0.0; + grad[41] = -0.5; + grad[42] = -0.5; + grad[43] = 0.0; + grad[44] = 0.0; + grad[45] = 0.0; + grad[46] = 0.0; + grad[47] = 0.0; + grad[48] = 1.0; + grad[49] = 0.0; + grad[50] = 0.0; + grad[51] = 0.0; + grad[52] = 0.0; + grad[53] = -1.0; + grad[54] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for sp_mp +
    [docs]/** + local minimization for cordierite */ -void sp_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[1]); - result[1] = ( eps_sf + x[1] + x[2] - 1.0); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + x[0] - 1.0); - result[4] = ( eps_sf + -x[0]); +void cd_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]); + result[1] = ( eps_sf + x[0] - 1.0); + result[2] = ( eps_sf + -x[1]); + result[3] = ( eps_sf + x[1] - 1.0); if (grad) { - grad[0] = 0.0; - grad[1] = -1.0; - grad[2] = 0.0; + grad[0] = -1.0; + grad[1] = 0.0; + grad[2] = 1.0; grad[3] = 0.0; - grad[4] = 1.0; - grad[5] = 1.0; + grad[4] = 0.0; + grad[5] = -1.0; grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = -1.0; - grad[9] = 1.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = -1.0; - grad[13] = 0.0; - grad[14] = 0.0; + grad[7] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for sa_mp +//--------------------------------------------------------------------------- +//---------------------------------Evans&Frost,2021-------------------------- +//--------------------------------------------------------------------------- + + +
    [docs]/** + Inequality constraints for fluid */ -void sa_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[2]*x[0] + x[2] - 0.75*x[3] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[2]*x[0] + 0.75*x[3] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[1]); - result[4] = ( eps_sf + 0.25*x[3] + x[0] - 1.0); - result[5] = ( eps_sf + -0.25*x[3] - x[0]); - result[6] = ( eps_sf + x[2] + x[1] - 1.0); - result[7] = ( eps_sf + -x[2] - x[1]); +void fluid_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]); + result[1] = ( eps_sf + x[0] - 1.0); if (grad) { - grad[0] = -x[2] - x[1] + 1.0; - grad[1] = 1.0 - x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = -0.75; - grad[4] = x[2] + x[1] - 1.0; - grad[5] = x[0]; - grad[6] = x[0]; - grad[7] = 0.75; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = -1.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 1.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.25; - grad[20] = -1.0; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -0.25; - grad[24] = 0.0; - grad[25] = 1.0; - grad[26] = 1.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = -1.0; - grad[30] = -1.0; - grad[31] = 0.0; + grad[0] = -1.0; + grad[1] = 1.0; } return; };
    -
    [docs]/** - Inequality constraints for pl4tr_mp +
    [docs]/** + Inequality constraints for ol */ -void pl4tr_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] - 1.0); +void ol_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - 1.0); result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -0.25*x[0] - 0.25); - result[4] = ( eps_sf + 0.25*x[0] - 0.75); if (grad) { grad[0] = 1.0; - grad[1] = 1.0; - grad[2] = -1.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.0; - grad[6] = -0.25; - grad[7] = 0.0; - grad[8] = 0.25; - grad[9] = 0.0; + grad[1] = -1.0; } return; };
    -
    [docs]/** - Inequality constraints for opx_mp +
    [docs]/** + Inequality constraints for br */ -void opx_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[4]*x[5] - x[3]*x[0] + x[3] + 0.5*x[1]*x[5] - x[1]*x[0] + x[1] - 0.5*x[5] - x[0]*x[2] + x[0] + x[2] - 1.0); - result[1] = ( eps_sf + -0.5*x[4]*x[5] + x[3]*x[0] - 0.5*x[1]*x[5] + x[1]*x[0] + 0.5*x[5] + x[0]*x[2] - x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -x[3]); - result[4] = ( eps_sf + -x[2]); - result[5] = ( eps_sf + -0.5*x[4]*x[5] - x[4]*x[0] + x[4] - 0.5*x[1]*x[5] - x[1]*x[0] + x[1] + 0.5*x[5] + x[0] - 1.0); - result[6] = ( eps_sf + 0.5*x[4]*x[5] + x[4]*x[0] + 0.5*x[1]*x[5] + x[1]*x[0] - 0.5*x[5] - x[0]); - result[7] = ( eps_sf + -x[1]); - result[8] = ( eps_sf + -x[4]); - result[9] = ( eps_sf + -0.5*x[3] - 0.5*x[2]); - result[10] = ( eps_sf + 0.5*x[3] + 0.5*x[2] - 1.0); +void br_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - 1.0); + result[1] = ( eps_sf + -x[0]); if (grad) { - grad[0] = -x[3] - x[1] - x[2] + 1.0; - grad[1] = 0.5*x[5] - x[0] + 1.0; - grad[2] = 1.0 - x[0]; - grad[3] = 1.0 - x[0]; - grad[4] = 0.5*x[5]; - grad[5] = 0.5*x[4] + 0.5*x[1] - 0.5; - grad[6] = x[3] + x[1] + x[2] - 1.0; - grad[7] = -0.5*x[5] + x[0]; - grad[8] = x[0]; - grad[9] = x[0]; - grad[10] = -0.5*x[5]; - grad[11] = -0.5*x[4] - 0.5*x[1] + 0.5; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = -1.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = -x[4] - x[1] + 1.0; - grad[31] = -0.5*x[5] - x[0] + 1.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = -0.5*x[5] - x[0] + 1.0; - grad[35] = -0.5*x[4] - 0.5*x[1] + 0.5; - grad[36] = x[4] + x[1] - 1.0; - grad[37] = 0.5*x[5] + x[0]; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.5*x[5] + x[0]; - grad[41] = 0.5*x[4] + 0.5*x[1] - 0.5; - grad[42] = 0.0; - grad[43] = -1.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = -1.0; - grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 0.0; - grad[56] = -0.50; - grad[57] = -0.50; - grad[58] = 0.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = 0.50; - grad[63] = 0.50; - grad[64] = 0.0; - grad[65] = 0.0; + grad[0] = 1.0; + grad[1] = -1.0; } return; };
    -
    [docs]/** - Inequality constraints for mu_mp +
    [docs]/** + Inequality constraints for ch */ -void mu_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[4] + x[3] - 1.0); - result[1] = ( eps_sf + -x[3]); - result[2] = ( eps_sf + -x[4]); - result[3] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); - result[4] = ( eps_sf + x[0]*x[1] - x[0]); - result[5] = ( eps_sf + -x[1]); - result[6] = ( eps_sf + x[2] - 1.0); - result[7] = ( eps_sf + -x[2]); - result[8] = ( eps_sf + 0.5*x[4] + 0.5*x[1] - 1.0); - result[9] = ( eps_sf + -0.5*x[4] - 0.5*x[1]); +void ch_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - 1.0); + result[1] = ( eps_sf + -x[0]); if (grad) { - grad[0] = 0.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 1.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = -1.0; + grad[0] = 1.0; + grad[1] = -1.0; + } + + return; +};
    + +
    [docs]/** + Inequality constraints for atg +*/ +void atg_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1]*x[3] + x[1] + x[2]*x[3] + x[2] -x[3] - 1.0); + result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] -x[1]*x[3] -x[2]*x[3] + x[3]); + result[2] = ( eps_sf + -x[2]); + result[3] = ( eps_sf + -x[1]); + result[4] = ( eps_sf + x[0] - 0.5*x[1]*x[3] - 0.5*x[2]*x[3] + 0.5*x[3] - 1.0); + result[5] = ( eps_sf + -x[0] + 0.5*x[1]*x[3] + 0.5*x[2]*x[3] - 0.5*x[3]); + result[6] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 1.0); + result[7] = ( eps_sf + -0.5*x[1] - 0.5*x[2]); + + if (grad) { + grad[0] = -x[1] -x[2] + 1.0; + grad[1] = -x[0] + x[3] + 1.0; + grad[2] = -x[0] + x[3] + 1.0; + grad[3] = x[1] + x[2] - 1.0; + grad[4] = x[1] + x[2] - 1.0; + grad[5] = x[0] -x[3]; + grad[6] = x[0] -x[3]; + grad[7] = -x[1] -x[2] + 1.0; + grad[8] = 0.0; grad[9] = 0.0; - grad[10] = 0.0; + grad[10] = -1.0; grad[11] = 0.0; grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = -1.0; - grad[15] = 1.0 - x[1]; - grad[16] = 1.0 - x[0]; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = x[1] - 1.0; - grad[21] = x[0]; - grad[22] = 0.0; - grad[23] = 0.0; + grad[13] = -1.0; + grad[14] = 0.0; + grad[15] = 0.0; + grad[16] = 1.0; + grad[17] = -0.5*x[3]; + grad[18] = -0.5*x[3]; + grad[19] = -0.5*x[1] - 0.5*x[2] + 0.5; + grad[20] = -1.0; + grad[21] = 0.5*x[3]; + grad[22] = 0.5*x[3]; + grad[23] = 0.5*x[1] + 0.5*x[2] - 0.5; grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = -1.0; + grad[25] = 0.50; + grad[26] = 0.50; grad[27] = 0.0; grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; + grad[29] = -0.50; + grad[30] = -0.50; grad[31] = 0.0; - grad[32] = 1.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = -1.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.50; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.50; - grad[45] = 0.0; - grad[46] = -0.50; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = -0.50; } return; };
    -
    [docs]/** - Inequality constraints for mt_mp +
    [docs]/** + Inequality constraints for g */ -void mt_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[0] - 0.5); - result[1] = ( eps_sf + 0.5*x[1] - x[0]); - result[2] = ( eps_sf + -0.5*x[1] + 0.5*x[0] - 0.5); - result[3] = ( eps_sf + -x[1]); - result[4] = ( eps_sf + x[1] - 1.0); +void g_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - 1.0); + result[1] = ( eps_sf + -x[0]); if (grad) { - grad[0] = 0.50; - grad[1] = 0.0; - grad[2] = -1.0; - grad[3] = 0.50; - grad[4] = 0.50; - grad[5] = -0.50; - grad[6] = 0.0; - grad[7] = -1.0; - grad[8] = 0.0; - grad[9] = 1.0; + grad[0] = 1.0; + grad[1] = -1.0; } return; };
    -
    [docs]/** - Inequality constraints for ma_mp +
    [docs]/** + Inequality constraints for ta */ -void ma_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[4] + x[3] - 1.0); - result[1] = ( eps_sf + -x[3]); - result[2] = ( eps_sf + -x[4]); - result[3] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); - result[4] = ( eps_sf + x[0]*x[1] - x[0]); - result[5] = ( eps_sf + -x[1]); - result[6] = ( eps_sf + x[2] - 1.0); - result[7] = ( eps_sf + -x[2]); - result[8] = ( eps_sf + 0.5*x[4] + 0.5*x[1] - 1.0); - result[9] = ( eps_sf + -0.5*x[4] - 0.5*x[1]); +void ta_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]*x[3] + x[0] + x[3]*x[4] + x[3] -x[4] - 1.0); + result[1] = ( eps_sf + x[0]*x[3] -x[0] -x[3]*x[4] + x[4]); + result[2] = ( eps_sf + -x[3]); + result[3] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1] + x[2] - 0.5*x[3]*x[4] + 0.5*x[4] - 1.0); + result[4] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] + 0.5*x[3]*x[4] - 0.5*x[4]); + result[5] = ( eps_sf + -x[2]); + result[6] = ( eps_sf + -x[1]); + result[7] = ( eps_sf + x[1] + x[2] -x[3] - 1.0); + result[8] = ( eps_sf + -x[1] -x[2] + x[3]); if (grad) { - grad[0] = 0.0; + grad[0] = 1.0 -x[3]; grad[1] = 0.0; grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 1.0; - grad[5] = 0.0; + grad[3] = -x[0] + x[4] + 1.0; + grad[4] = x[3] - 1.0; + grad[5] = x[3] - 1.0; grad[6] = 0.0; grad[7] = 0.0; - grad[8] = -1.0; - grad[9] = 0.0; + grad[8] = x[0] -x[4]; + grad[9] = 1.0 -x[3]; grad[10] = 0.0; grad[11] = 0.0; grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = -1.0; - grad[15] = 1.0 - x[1]; - grad[16] = 1.0 - x[0]; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = x[1] - 1.0; + grad[13] = -1.0; + grad[14] = 0.0; + grad[15] = -x[1] -x[2] + 1.0; + grad[16] = 1.0 -x[0]; + grad[17] = 1.0 -x[0]; + grad[18] = -0.5*x[4]; + grad[19] = 0.5 - 0.5*x[3]; + grad[20] = x[1] + x[2] - 1.0; grad[21] = x[0]; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; + grad[22] = x[0]; + grad[23] = 0.5*x[4]; + grad[24] = 0.5*x[3] - 0.5; grad[25] = 0.0; - grad[26] = -1.0; - grad[27] = 0.0; + grad[26] = 0.0; + grad[27] = -1.0; grad[28] = 0.0; grad[29] = 0.0; grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = 1.0; + grad[31] = -1.0; + grad[32] = 0.0; grad[33] = 0.0; grad[34] = 0.0; grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = -1.0; - grad[38] = 0.0; + grad[36] = 1.0; + grad[37] = 1.0; + grad[38] = -1.0; grad[39] = 0.0; grad[40] = 0.0; - grad[41] = 0.50; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.50; - grad[45] = 0.0; - grad[46] = -0.50; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = -0.50; + grad[41] = -1.0; + grad[42] = -1.0; + grad[43] = 1.0; + grad[44] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for ilm_mp +
    [docs]/** + Inequality constraints for chl */ -void ilm_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[2] - 0.5*x[3] - 0.5*x[0] + 0.5*x[1]); - result[1] = ( eps_sf + 0.5*x[2] + 0.5*x[3] - 0.5*x[0] + 0.5*x[1]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -x[2]); - result[4] = ( eps_sf + x[0] - 1.0); - result[5] = ( eps_sf + -0.5*x[2] - 0.5*x[3] - 0.5*x[0] - 0.5*x[1]); +void chl_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]*x[1] + x[0]*x[3] + x[0] + x[1]*x[4] + x[1] -x[3]*x[4] -x[3] -x[4] - 1.0); + result[1] = ( eps_sf + x[0]*x[1] -x[0]*x[3] -x[0] -x[1]*x[4] + x[3]*x[4] + x[4]); + result[2] = ( eps_sf + -x[1] + x[3]); + result[3] = ( eps_sf + x[0] - 0.25*x[1]*x[4] - 0.25*x[1]*x[5] - 0.25*x[2]*x[5] + 0.25*x[3]*x[4] - 0.25*x[3]*x[5] + 0.25*x[4] + 0.25*x[5] - 1.0); + result[4] = ( eps_sf + -x[0] + 0.25*x[1]*x[4] + 0.25*x[1]*x[5] + 0.25*x[2]*x[5] - 0.25*x[3]*x[4] + 0.25*x[3]*x[5] - 0.25*x[4] - 0.25*x[5]); + result[5] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] -x[0]*x[3] + x[0] + x[1]*x[5] + x[1] + x[2]*x[5] + x[2] + x[3]*x[5] + x[3] -x[5] - 1.0); + result[6] = ( eps_sf + x[0]*x[1] + x[0]*x[2] + x[0]*x[3] -x[0] -x[1]*x[5] -x[2]*x[5] -x[3]*x[5] + x[5]); + result[7] = ( eps_sf + -x[2]); + result[8] = ( eps_sf + -x[1] -x[3]); + result[9] = ( eps_sf + x[1] + 0.5*x[2] - 1.0); + result[10] = ( eps_sf + -x[1] - 0.5*x[2]); if (grad) { - grad[0] = -0.50; - grad[1] = 0.50; - grad[2] = 0.50; - grad[3] = -0.50; - grad[4] = -0.50; - grad[5] = 0.50; - grad[6] = 0.50; - grad[7] = 0.50; + grad[0] = -x[1] + x[3] + 1.0; + grad[1] = -x[0] + x[4] + 1.0; + grad[2] = 0.0; + grad[3] = x[0] -x[4] - 1.0; + grad[4] = x[1] -x[3] - 1.0; + grad[5] = 0.0; + grad[6] = x[1] -x[3] - 1.0; + grad[7] = x[0] -x[4]; grad[8] = 0.0; - grad[9] = -1.0; - grad[10] = 0.0; + grad[9] = -x[0] + x[4]; + grad[10] = -x[1] + x[3] + 1.0; grad[11] = 0.0; grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = -1.0; - grad[15] = 0.0; - grad[16] = 1.0; + grad[13] = -1.0; + grad[14] = 0.0; + grad[15] = 1.0; + grad[16] = 0.0; grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = -0.50; - grad[21] = -0.50; - grad[22] = -0.50; - grad[23] = -0.50; + grad[18] = 1.0; + grad[19] = -0.25*x[4] - 0.25*x[5]; + grad[20] = -0.25*x[5]; + grad[21] = 0.25*x[4] - 0.25*x[5]; + grad[22] = -0.25*x[1] + 0.25*x[3] + 0.25; + grad[23] = -0.25*x[1] - 0.25*x[2] - 0.25*x[3] + 0.25; + grad[24] = -1.0; + grad[25] = 0.25*x[4] + 0.25*x[5]; + grad[26] = 0.25*x[5]; + grad[27] = -0.25*x[4] + 0.25*x[5]; + grad[28] = 0.25*x[1] - 0.25*x[3] - 0.25; + grad[29] = 0.25*x[1] + 0.25*x[2] + 0.25*x[3] - 0.25; + grad[30] = -x[1] -x[2] -x[3] + 1.0; + grad[31] = -x[0] + x[5] + 1.0; + grad[32] = -x[0] + x[5] + 1.0; + grad[33] = -x[0] + x[5] + 1.0; + grad[34] = 0.0; + grad[35] = x[1] + x[2] + x[3] - 1.0; + grad[36] = x[1] + x[2] + x[3] - 1.0; + grad[37] = x[0] -x[5]; + grad[38] = x[0] -x[5]; + grad[39] = x[0] -x[5]; + grad[40] = 0.0; + grad[41] = -x[1] -x[2] -x[3] + 1.0; + grad[42] = 0.0; + grad[43] = 0.0; + grad[44] = -1.0; + grad[45] = 0.0; + grad[46] = 0.0; + grad[47] = 0.0; + grad[48] = 0.0; + grad[49] = -1.0; + grad[50] = 0.0; + grad[51] = -1.0; + grad[52] = 0.0; + grad[53] = 0.0; + grad[54] = 0.0; + grad[55] = 1.0; + grad[56] = 0.50; + grad[57] = 0.0; + grad[58] = 0.0; + grad[59] = 0.0; + grad[60] = 0.0; + grad[61] = -1.0; + grad[62] = -0.50; + grad[63] = 0.0; + grad[64] = 0.0; + grad[65] = 0.0; } return; };
    -
    [docs]/** - Inequality constraints for g_mp +
    [docs]/** + Inequality constraints for anth */ -void g_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf - x[2]*x[0] + x[2] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[2]*x[0] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf - x[2]); - result[3] = ( eps_sf - x[1]); - result[4] = ( eps_sf - 1.0 + x[3]); - result[5] = ( eps_sf - x[3]); +void anth_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - x[1]*x[3] + 1.5*x[2] + x[3] - 1.0); + result[1] = ( eps_sf + -x[0] + x[1]*x[3] - 1.5*x[2] - x[3]); + result[2] = ( eps_sf + x[0] - x[2] - 1.0); + result[3] = ( eps_sf + -x[0] + x[2]); + result[4] = ( eps_sf + -x[1]); + result[5] = ( eps_sf + -x[0]*x[1] + x[0] + x[1]*x[3] + x[1] - x[3] - 1.0); + result[6] = ( eps_sf + x[0]*x[1] - x[0] - x[1]*x[3] + x[3]); + result[7] = ( eps_sf + -0.5*x[1]); + result[8] = ( eps_sf + 0.5*x[1] - 1.0); if (grad) { - grad[0] = -x[2] - x[1] + 1.0; - grad[1] = 1.0 - x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = 0.0; - grad[4] = x[2] + x[1] - 1.0; - grad[5] = x[0]; - grad[6] = x[0]; - grad[7] = 0.0; - grad[8] = 0.0; + grad[0] = 1.0; + grad[1] = -x[3]; + grad[2] = 1.5; + grad[3] = 1.0 - x[1]; + grad[4] = -1.0; + grad[5] = x[3]; + grad[6] = -1.5; + grad[7] = x[1] - 1.0; + grad[8] = 1.0; grad[9] = 0.0; grad[10] = -1.0; grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; + grad[12] = -1.0; + grad[13] = 0.0; + grad[14] = 1.0; grad[15] = 0.0; grad[16] = 0.0; - grad[17] = 0.0; + grad[17] = -1.0; grad[18] = 0.0; - grad[19] = 1.0; - grad[20] = 0.0; - grad[21] = 0.0; + grad[19] = 0.0; + grad[20] = 1.0 - x[1]; + grad[21] = -x[0] + x[3] + 1.0; grad[22] = 0.0; - grad[23] = -1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for ep_mp -*/ -void ep_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0] + x[1]); - result[1] = ( eps_sf + x[0] - x[1] - 1.0); - result[2] = ( eps_sf + -x[0] - x[1]); - result[3] = ( eps_sf + x[0] + x[1] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 1.0; - grad[2] = 1.0; - grad[3] = -1.0; - grad[4] = -1.0; - grad[5] = -1.0; - grad[6] = 1.0; - grad[7] = 1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for ctd_mp -*/ -void ctd_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[2] - 1.0); - result[1] = ( eps_sf + -x[2]); - result[2] = ( eps_sf + x[1]*x[0] - x[0]); - result[3] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); - result[4] = ( eps_sf + -x[1]); - - if (grad) { - grad[0] = 0.0; - grad[1] = 0.0; - grad[2] = 1.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.0; - grad[6] = x[1] - 1.0; - grad[7] = x[0]; - grad[8] = 0.0; - grad[9] = 1.0 - x[1]; - grad[10] = 1.0 - x[0]; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - } - - return; -}
    - -
    [docs]/** - Inequality constraints for chl_mp -*/ -void chl_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[3]*x[5] - x[3]*x[0] + x[3] - x[5]*x[4] + x[5]*x[1] - x[5] + x[4]*x[0] - x[4] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + -x[3]*x[5] + x[3]*x[0] + x[5]*x[4] - x[5]*x[1] + x[5] - x[4]*x[0] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + x[4] - x[1]); - result[3] = ( eps_sf + -0.25*x[2]*x[6] - 0.25*x[3]*x[5] - x[3]*x[0] + x[3] + 0.25*x[5]*x[4] - 0.25*x[5]*x[1] + 0.25*x[5] - 0.25*x[6]*x[4] - 0.25*x[6]*x[1] + 0.25*x[6] + x[0] - 1.0); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + 0.25*x[2]*x[6] + 0.25*x[3]*x[5] + x[3]*x[0] - 0.25*x[5]*x[4] + 0.25*x[5]*x[1] - 0.25*x[5] + 0.25*x[6]*x[4] + 0.25*x[6]*x[1] - 0.25*x[6] - x[0]); - result[6] = ( eps_sf + x[2]*x[6] - x[2]*x[0] + x[2] + x[6]*x[4] + x[6]*x[1] - x[6] - x[4]*x[0] + x[4] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[7] = ( eps_sf + -x[2]*x[6] + x[2]*x[0] - x[6]*x[4] - x[6]*x[1] + x[6] + x[4]*x[0] + x[0]*x[1] - x[0]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -x[4] - x[1]); - result[10] = ( eps_sf + 0.5*x[2] + x[1] - 1.0); - result[11] = ( eps_sf + -0.5*x[2] - x[1]); - - if (grad) { - grad[0] = -x[3] + x[4] - x[1] + 1.0; - grad[1] = x[5] - x[0] + 1.0; - grad[2] = 0.0; - grad[3] = x[5] - x[0] + 1.0; - grad[4] = -x[5] + x[0] - 1.0; - grad[5] = x[3] - x[4] + x[1] - 1.0; - grad[6] = 0.0; - grad[7] = x[3] - x[4] + x[1] - 1.0; - grad[8] = -x[5] + x[0]; - grad[9] = 0.0; - grad[10] = -x[5] + x[0]; - grad[11] = x[5] - x[0]; - grad[12] = -x[3] + x[4] - x[1] + 1.0; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = -1.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 1.0; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = 1.0 - x[3]; - grad[22] = -0.25*x[5] - 0.25*x[6]; - grad[23] = -0.25*x[6]; - grad[24] = -0.25*x[5] - x[0] + 1.0; - grad[25] = 0.25*x[5] - 0.25*x[6]; - grad[26] = -0.25*x[3] + 0.25*x[4] - 0.25*x[1] + 0.25; - grad[27] = -0.25*x[2] - 0.25*x[4] - 0.25*x[1] + 0.25; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = -1.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = x[3] - 1.0; - grad[36] = 0.25*x[5] + 0.25*x[6]; - grad[37] = 0.25*x[6]; - grad[38] = 0.25*x[5] + x[0]; - grad[39] = -0.25*x[5] + 0.25*x[6]; - grad[40] = 0.25*x[3] - 0.25*x[4] + 0.25*x[1] - 0.25; - grad[41] = 0.25*x[2] + 0.25*x[4] + 0.25*x[1] - 0.25; - grad[42] = -x[2] - x[4] - x[1] + 1.0; - grad[43] = x[6] - x[0] + 1.0; - grad[44] = x[6] - x[0] + 1.0; - grad[45] = 0.0; - grad[46] = x[6] - x[0] + 1.0; - grad[47] = 0.0; - grad[48] = x[2] + x[4] + x[1] - 1.0; - grad[49] = x[2] + x[4] + x[1] - 1.0; - grad[50] = -x[6] + x[0]; - grad[51] = -x[6] + x[0]; - grad[52] = 0.0; - grad[53] = -x[6] + x[0]; - grad[54] = 0.0; - grad[55] = -x[2] - x[4] - x[1] + 1.0; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = -1.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = -1.0; - grad[65] = 0.0; - grad[66] = 0.0; - grad[67] = -1.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 0.0; - grad[71] = 1.0; - grad[72] = 0.50; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = -1.0; - grad[79] = -0.50; - grad[80] = 0.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for cd_mp -*/ -void cd_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -x[2]); - result[4] = ( eps_sf + x[2] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 0.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = -1.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = -1.0; - grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = 1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for bi_mp -*/ -void bi_mp_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf - x[3]*x[0] + x[3] - 3.0*x[1]*x[0] + x[1] + 2.0/3.0*x[5] - x[4]*x[0] + x[4] - x[0]*x[2] + x[0] + x[2] - 1.0); - result[1] = ( eps_sf - x[1]); - result[2] = ( eps_sf + x[3]*x[0] + 3.0*x[1]*x[0] - 2.0/3.0*x[5] + x[4]*x[0] + x[0]*x[2] - x[0]); - result[3] = ( eps_sf - x[3]); - result[4] = ( eps_sf - x[4]); - result[5] = ( eps_sf - x[2]); - result[6] = ( eps_sf + x[1] - 1.0/3.0*x[5] + x[0] - 1.0); - result[7] = ( eps_sf - x[1]); - result[8] = ( eps_sf + 1.0/3.0*x[5] - x[0]); - result[9] = ( eps_sf + 0.5*x[3] + 0.5*x[2] - 0.5); - result[10] = ( eps_sf - 0.5*x[3] - 0.5*x[2] - 0.5); - result[11] = ( eps_sf + x[4] - 1.0); - result[12] = ( eps_sf - x[4]); - - if (grad) { - grad[0] = -x[3] - 3.0*x[1] - x[4] - x[2] + 1.0; - grad[1] = 1.0 - 3.0*x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = 1.0 - x[0]; - grad[4] = 1.0 - x[0]; - grad[5] = 2.0/3.0; - grad[6] = 0.0; - grad[7] = -1.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = x[3] + 3.0*x[1] + x[4] + x[2] - 1.0; - grad[13] = 3.0*x[0]; - grad[14] = x[0]; - grad[15] = x[0]; - grad[16] = x[0]; - grad[17] = -2.0/3.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 0.0; + grad[23] = x[1] - 1.0; + grad[24] = x[1] - 1.0; + grad[25] = x[0] - x[3]; grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = -1.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = -1.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 1.0; - grad[37] = 1.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = -1.0/3.0; - grad[42] = 0.0; - grad[43] = -1.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = -1.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; - grad[53] = 1.0/3.0; - grad[54] = 0.0; - grad[55] = 0.0; - grad[56] = 0.50; - grad[57] = 0.50; - grad[58] = 0.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = -0.50; - grad[63] = -0.50; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = 0.0; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 1.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = -1.0; - grad[77] = 0.0; - } - - return; -};
    - -
    [docs]/** - local minimization for clinopyroxene -*/ -void cpx_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[8]*x[4] - x[8]*x[0] + x[8] - x[3]*x[4] - x[3]*x[0] + x[3] + x[4]*x[7] - x[4]*x[1] + x[4] + x[7]*x[0] - x[7] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[8]*x[4] + x[8]*x[0] + x[3]*x[4] + x[3]*x[0] - x[4]*x[7] + x[4]*x[1] - x[4] - x[7]*x[0] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + x[6] + x[5] - x[8] - x[3] + 2.0*x[7] - x[1]); - result[3] = ( eps_sf + -x[5]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[7]); - result[6] = ( eps_sf + x[8]*x[4] + x[3]*x[4] + x[2]*x[0] - x[2] - x[4]*x[7] + x[4]*x[1] - x[4]); - result[7] = ( eps_sf + -x[8]*x[4] - x[3]*x[4] - x[2]*x[0] + x[4]*x[7] - x[4]*x[1] + x[4]); - result[8] = ( eps_sf + x[8] + x[3] + x[2] - 1.0); - result[9] = ( eps_sf + -x[3]); - result[10] = ( eps_sf + -x[8]); - result[11] = ( eps_sf + 0.5*x[1] - 1.0); - result[12] = ( eps_sf + -0.5*x[1]); - - if (grad) { - grad[0] = -x[8] - x[3] + x[7] - x[1] + 1.0; - grad[1] = -x[4] - x[0] + 1.0; - grad[2] = 0.0; - grad[3] = -x[4] - x[0] + 1.0; - grad[4] = -x[8] - x[3] + x[7] - x[1] + 1.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = x[4] + x[0] - 1.0; - grad[8] = -x[4] - x[0] + 1.0; - grad[9] = x[8] + x[3] - x[7] + x[1] - 1.0; - grad[10] = x[4] + x[0]; - grad[11] = 0.0; - grad[12] = x[4] + x[0]; - grad[13] = x[8] + x[3] - x[7] + x[1] - 1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = -x[4] - x[0]; - grad[17] = x[4] + x[0]; - grad[18] = 0.0; - grad[19] = -1.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 1.0; - grad[24] = 1.0; - grad[25] = 2.0; - grad[26] = -1.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = -1.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = -1.0; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = -1.0; - grad[53] = 0.0; - grad[54] = x[2]; - grad[55] = x[4]; - grad[56] = x[0] - 1.0; - grad[57] = x[4]; - grad[58] = x[8] + x[3] - x[7] + x[1] - 1.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = -x[4]; - grad[62] = x[4]; - grad[63] = -x[2]; - grad[64] = -x[4]; - grad[65] = -x[0]; - grad[66] = -x[4]; - grad[67] = -x[8] - x[3] + x[7] - x[1] + 1.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = x[4]; - grad[71] = -x[4]; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 1.0; - grad[75] = 1.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 1.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = -1.0; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = 0.0; - grad[98] = -1.0; - grad[99] = 0.0; - grad[100] = 0.50; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = 0.0; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = 0.0; - grad[109] = -0.50; - grad[110] = 0.0; - grad[111] = 0.0; - grad[112] = 0.0; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 0.0; - grad[116] = 0.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for epidote -*/ -void ep_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0] + x[1]); - result[1] = ( eps_sf + x[0] - x[1] - 1.0); - result[2] = ( eps_sf + -x[0] - x[1]); - result[3] = ( eps_sf + x[0] + x[1] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 1.0; - grad[2] = 1.0; - grad[3] = -1.0; - grad[4] = -1.0; - grad[5] = -1.0; - grad[6] = 1.0; - grad[7] = 1.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for fluid -*/ -void fl_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 1.0); - result[1] = ( eps_sf + -x[1]); - result[2] = ( eps_sf + -x[0]); - result[3] = ( eps_sf + -x[2]); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + -x[4]); - result[6] = ( eps_sf + -x[5]); - result[7] = ( eps_sf + -x[6]); - result[8] = ( eps_sf + -x[7]); - result[9] = ( eps_sf + -x[8]); - result[10] = ( eps_sf + -x[9]); - result[11] = ( eps_sf + x[9] - 1.0); - - if (grad) { - grad[0] = 1.00; - grad[1] = 1.00; - grad[2] = 1.00; - grad[3] = 1.00; - grad[4] = 1.00; - grad[5] = 1.00; - grad[6] = 1.00; - grad[7] = 1.00; - grad[8] = 1.00; - grad[9] = 1.00; - grad[10] = 0.0; - grad[11] = -1.00; - grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = -1.00; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = -1.00; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = -1.00; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; - grad[53] = 0.0; - grad[54] = -1.00; - grad[55] = 0.0; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = 0.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = -1.00; - grad[66] = 0.0; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 0.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = -1.00; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 0.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = -1.00; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = 0.0; - grad[98] = -1.00; - grad[99] = 0.0; - grad[100] = 0.0; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = 0.0; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = 0.0; - grad[109] = -1.00; - grad[110] = 0.0; - grad[111] = 0.0; - grad[112] = 0.0; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 0.0; - grad[116] = 0.0; - grad[117] = 0.0; - grad[118] = 0.0; - grad[119] = 1.00; - } - - return; -};
    - - -
    [docs]/** - local minimization for garnet -*/ -void g_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[1]*x[0] + x[1] + x[0] - 1.0); - result[1] = ( eps_sf + x[1]*x[0] - x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[3] + x[2] + 2.0*x[4] - 1.0); - result[4] = ( eps_sf + -x[3]); - result[5] = ( eps_sf + -x[2]); - result[6] = ( eps_sf + -x[4]); - - if (grad) { - grad[0] = 1.0 - x[1]; - grad[1] = 1.0 - x[0]; - grad[2] = 0.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = x[1] - 1.0; - grad[6] = x[0]; - grad[7] = 0.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = -1.0; - grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 1.0; - grad[18] = 1.0; - grad[19] = 2.0; - grad[20] = 0.0; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -1.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = -1.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = -1.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for hornblende -*/ -void hb_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[3] - 1.0); - result[1] = ( eps_sf + x[3]*x[4] - x[3]); - result[2] = ( eps_sf + -x[3]*x[4]); - result[3] = ( eps_sf + -x[8] + x[0] - 1.0); - result[4] = ( eps_sf + x[8] - x[0]); - result[5] = ( eps_sf + x[9]*x[6] + x[9]*x[7] + x[9]*x[1] - x[9] - x[6]*x[0] + x[6] - x[7]*x[0] + x[7] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[6] = ( eps_sf + -x[9]*x[6] - x[9]*x[7] - x[9]*x[1] + x[9] + x[6]*x[0] + x[7]*x[0] + x[0]*x[1] - x[0]); - result[7] = ( eps_sf + -x[1]); - result[8] = ( eps_sf + -x[6]); - result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + -x[5]); - result[11] = ( eps_sf + 1.5*x[8] - x[9]*x[6] - x[9]*x[7] - x[9]*x[1] + x[9] - x[5]*x[0] + x[5] - x[0]*x[2] + x[0] + x[2] - 1.0); - result[12] = ( eps_sf + -1.5*x[8] + x[9]*x[6] + x[9]*x[7] + x[9]*x[1] - x[9] + x[5]*x[0] + x[0]*x[2] - x[0]); - result[13] = ( eps_sf + -x[2]); - result[14] = ( eps_sf + 0.25*x[3] + 0.5*x[6] + 0.5*x[7] + 0.5*x[1] - 0.5*x[2] - 1.0); - result[15] = ( eps_sf + -0.25*x[3] - 0.5*x[6] - 0.5*x[7] - 0.5*x[1] + 0.5*x[2]); - result[16] = ( eps_sf + x[7] - 1.0); - - if (grad) { - grad[0] = 0.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 0.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = x[4] - 1.0; - grad[14] = x[3]; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -x[4]; - grad[24] = -x[3]; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 1.0; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.0; - grad[39] = 0.0; - grad[40] = -1.0; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 1.0; - grad[49] = 0.0; - grad[50] = -x[6] - x[7] - x[1] + 1.0; - grad[51] = x[9] - x[0] + 1.0; - grad[52] = 0.0; - grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 0.0; - grad[56] = x[9] - x[0] + 1.0; - grad[57] = x[9] - x[0] + 1.0; - grad[58] = 0.0; - grad[59] = x[6] + x[7] + x[1] - 1.0; - grad[60] = x[6] + x[7] + x[1] - 1.0; - grad[61] = -x[9] + x[0]; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -x[9] + x[0]; - grad[67] = -x[9] + x[0]; - grad[68] = 0.0; - grad[69] = -x[6] - x[7] - x[1] + 1.0; - grad[70] = 0.0; - grad[71] = -1.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 0.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = -1.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = -1.0; - grad[98] = 0.0; - grad[99] = 0.0; - grad[100] = 0.0; - grad[101] = 0.0; - grad[102] = 0.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = -1.0; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = 0.0; - grad[109] = 0.0; - grad[110] = -x[5] - x[2] + 1.0; - grad[111] = -x[9]; - grad[112] = 1.0 - x[0]; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 1.0 - x[0]; - grad[116] = -x[9]; - grad[117] = -x[9]; - grad[118] = 1.50; - grad[119] = -x[6] - x[7] - x[1] + 1.0; - grad[120] = x[5] + x[2] - 1.0; - grad[121] = x[9]; - grad[122] = x[0]; - grad[123] = 0.0; - grad[124] = 0.0; - grad[125] = x[0]; - grad[126] = x[9]; - grad[127] = x[9]; - grad[128] = -1.50; - grad[129] = x[6] + x[7] + x[1] - 1.0; - grad[130] = 0.0; - grad[131] = 0.0; - grad[132] = -1.0; - grad[133] = 0.0; - grad[134] = 0.0; - grad[135] = 0.0; - grad[136] = 0.0; - grad[137] = 0.0; - grad[138] = 0.0; - grad[139] = 0.0; - grad[140] = 0.0; - grad[141] = 0.50; - grad[142] = -0.50; - grad[143] = 0.250; - grad[144] = 0.0; - grad[145] = 0.0; - grad[146] = 0.50; - grad[147] = 0.50; - grad[148] = 0.0; - grad[149] = 0.0; - grad[150] = 0.0; - grad[151] = -0.50; - grad[152] = 0.50; - grad[153] = -0.250; - grad[154] = 0.0; - grad[155] = 0.0; - grad[156] = -0.50; - grad[157] = -0.50; - grad[158] = 0.0; - grad[159] = 0.0; - grad[160] = 0.0; - grad[161] = 0.0; - grad[162] = 0.0; - grad[163] = 0.0; - grad[164] = 0.0; - grad[165] = 0.0; - grad[166] = 0.0; - grad[167] = 1.0; - grad[168] = 0.0; - grad[169] = 0.0; - } - - return; -};
    - - -
    [docs]/** - Inequality constraints for ilm -*/ -void ilm_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] - 0.5*x[2]); - result[1] = ( eps_sf + -0.5*x[0] + 0.5*x[3]); - result[2] = ( eps_sf + x[0] - 1.0); - result[3] = ( eps_sf + -0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]); - result[4] = ( eps_sf + 0.5*x[0]*x[1] - 0.5*x[0] + 0.5*x[2]); - result[5] = ( eps_sf + -0.5*x[0] - 0.5*x[3]); - result[6] = ( eps_sf + x[0] - 1.0); - result[7] = ( eps_sf + -0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]); - - if (grad) { - grad[0] = 0.5*x[1] - 0.5; - grad[1] = 0.5*x[0]; - grad[2] = -0.500; - grad[3] = 0.0; - grad[4] = -0.500; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.500; - grad[8] = 1.00; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = -0.5*x[1]; - grad[13] = -0.5*x[0]; - grad[14] = 0.500; - grad[15] = -0.500; - grad[16] = 0.5*x[1] - 0.5; - grad[17] = 0.5*x[0]; - grad[18] = 0.500; - grad[19] = 0.0; - grad[20] = -0.500; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -0.500; - grad[24] = 1.00; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = -0.5*x[1]; - grad[29] = -0.5*x[0]; - grad[30] = -0.500; - grad[31] = 0.500; - } - - return; -};
    - - - -
    [docs]/** - Inequality constraints for liqHw -*/ -void liq_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf +x[6] +x[3] +x[2] +x[10] +x[5] +x[4] +x[8] +x[1] +x[7] +x[0] - 0.25*x[9]*(-3.0*x[6] - 3.0*x[3] - 3.0*x[2] - 3.0*x[10] - 3.0*x[5] - 3.0*x[4] - 3.0*x[8] - 3.0*x[1] - 3.0*x[7] - 3.0*x[0] + 4.0) - 1.0); - result[1] = ( eps_sf + -0.75*x[1]*x[9] - x[1] +x[9]); - result[2] = ( eps_sf + -0.75*x[0]*x[9] - x[0] +x[9]); - result[3] = ( eps_sf + -0.75*x[4]*x[9] - x[4]); - result[4] = ( eps_sf + -0.75*x[5]*x[9] - x[5]); - result[5] = ( eps_sf + -0.75*x[6]*x[9] - x[6]); - result[6] = ( eps_sf + -0.75*x[7]*x[9] - x[7]); - result[7] = ( eps_sf + -0.75*x[8]*x[9] - x[8]); - result[8] = ( eps_sf + -x[9]); - result[9] = ( eps_sf + -x[3] - x[2] - 0.75*x[9]*(x[3] + x[2])); - result[10] = ( eps_sf + 0.75*x[10]*x[9] +x[10] - 1.0); - result[11] = ( eps_sf + -4.0*x[2]*(0.75*x[9] + 1.0)); - result[12] = ( eps_sf + -4.0*x[3]*(0.75*x[9] + 1.0)); - result[13] = ( eps_sf + -x[0]*(0.75*x[9] + 1.0) +x[9]); - result[14] = ( eps_sf + -x[1]*(0.75*x[9] + 1.0) +x[9]); - result[15] = ( eps_sf + 2.0*x[9] - (0.75*x[9] + 1.0)*(4.0*x[3] + 4.0*x[2] + x[1] + x[0])); - result[16] = ( eps_sf + -x[10]*(0.75*x[9] + 1.0)); - result[17] = ( eps_sf + 0.75*x[10]*x[9] +x[10] - 1.0); - - if (grad) { - grad[0] = 0.75*x[9] + 1.0; - grad[1] = 0.75*x[9] + 1.0; - grad[2] = 0.75*x[9] + 1.0; - grad[3] = 0.75*x[9] + 1.0; - grad[4] = 0.75*x[9] + 1.0; - grad[5] = 0.75*x[9] + 1.0; - grad[6] = 0.75*x[9] + 1.0; - grad[7] = 0.75*x[9] + 1.0; - grad[8] = 0.75*x[9] + 1.0; - grad[9] = 0.75*x[6] + 0.75*x[3] + 0.75*x[2] + 0.75*x[10] + 0.75*x[5] + 0.75*x[4] + 0.75*x[8] + 0.75*x[1] + 0.75*x[7] + 0.75*x[0] - 1.0; - grad[10] = 0.75*x[9] + 1.0; - grad[11] = 0.0; - grad[12] = -0.75*x[9] - 1.0; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 1.0 - 0.75*x[1]; - grad[21] = 0.0; - grad[22] = -0.75*x[9] - 1.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 1.0 - 0.75*x[0]; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = -0.75*x[9] - 1.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = -0.75*x[4]; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = -0.75*x[9] - 1.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; - grad[53] = -0.75*x[5]; - grad[54] = 0.0; - grad[55] = 0.0; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = 0.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = -0.75*x[9] - 1.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = -0.75*x[6]; - grad[65] = 0.0; - grad[66] = 0.0; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 0.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = -0.75*x[9] - 1.0; - grad[74] = 0.0; - grad[75] = -0.75*x[7]; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = 0.0; - grad[80] = 0.0; - grad[81] = 0.0; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = -0.75*x[9] - 1.0; - grad[86] = -0.75*x[8]; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = 0.0; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - grad[96] = 0.0; - grad[97] = -1.00; - grad[98] = 0.0; - grad[99] = 0.0; - grad[100] = 0.0; - grad[101] = -0.75*x[9] - 1.0; - grad[102] = -0.75*x[9] - 1.0; - grad[103] = 0.0; - grad[104] = 0.0; - grad[105] = 0.0; - grad[106] = 0.0; - grad[107] = 0.0; - grad[108] = -0.75*x[3] - 0.75*x[2]; - grad[109] = 0.0; - grad[110] = 0.0; - grad[111] = 0.0; - grad[112] = 0.0; - grad[113] = 0.0; - grad[114] = 0.0; - grad[115] = 0.0; - grad[116] = 0.0; - grad[117] = 0.0; - grad[118] = 0.0; - grad[119] = 0.75*x[10]; - grad[120] = 0.75*x[9] + 1.0; - grad[121] = 0.0; - grad[122] = 0.0; - grad[123] = -3.0*x[9] - 4.0; - grad[124] = 0.0; - grad[125] = 0.0; - grad[126] = 0.0; - grad[127] = 0.0; - grad[128] = 0.0; - grad[129] = 0.0; - grad[130] = -3.0*x[2]; - grad[131] = 0.0; - grad[132] = 0.0; - grad[133] = 0.0; - grad[134] = 0.0; - grad[135] = -3.0*x[9] - 4.0; - grad[136] = 0.0; - grad[137] = 0.0; - grad[138] = 0.0; - grad[139] = 0.0; - grad[140] = 0.0; - grad[141] = -3.0*x[3]; - grad[142] = 0.0; - grad[143] = -0.75*x[9] - 1.0; - grad[144] = 0.0; - grad[145] = 0.0; - grad[146] = 0.0; - grad[147] = 0.0; - grad[148] = 0.0; - grad[149] = 0.0; - grad[150] = 0.0; - grad[151] = 0.0; - grad[152] = 1.0 - 0.75*x[0]; - grad[153] = 0.0; - grad[154] = 0.0; - grad[155] = -0.75*x[9] - 1.0; - grad[156] = 0.0; - grad[157] = 0.0; - grad[158] = 0.0; - grad[159] = 0.0; - grad[160] = 0.0; - grad[161] = 0.0; - grad[162] = 0.0; - grad[163] = 1.0 - 0.75*x[1]; - grad[164] = 0.0; - grad[165] = -0.75*x[9] - 1.0; - grad[166] = -0.75*x[9] - 1.0; - grad[167] = -3.0*x[9] - 4.0; - grad[168] = -3.0*x[9] - 4.0; - grad[169] = 0.0; - grad[170] = 0.0; - grad[171] = 0.0; - grad[172] = 0.0; - grad[173] = 0.0; - grad[174] = -3.0*x[3] - 3.0*x[2] - 0.75*x[1] - 0.75*x[0] + 2.0; - grad[175] = 0.0; - grad[176] = 0.0; - grad[177] = 0.0; - grad[178] = 0.0; - grad[179] = 0.0; - grad[180] = 0.0; - grad[181] = 0.0; - grad[182] = 0.0; - grad[183] = 0.0; - grad[184] = 0.0; - grad[185] = -0.75*x[10]; - grad[186] = -0.75*x[9] - 1.0; - grad[187] = 0.0; - grad[188] = 0.0; - grad[189] = 0.0; - grad[190] = 0.0; - grad[191] = 0.0; - grad[192] = 0.0; - grad[193] = 0.0; - grad[194] = 0.0; - grad[195] = 0.0; - grad[196] = 0.75*x[10]; - grad[197] = 0.75*x[9] + 1.0; - } - - return; -};
    - -
    [docs]/** - local minimization for muscovite -*/ -void mu_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[4] + x[3] - 1.0); - result[1] = ( eps_sf + -x[3]); - result[2] = ( eps_sf + -x[4]); - result[3] = ( eps_sf + -x[0]*x[1] + x[0] + x[1] - 1.0); - result[4] = ( eps_sf + x[0]*x[1] - x[0]); - result[5] = ( eps_sf + -x[1]); - result[6] = ( eps_sf + x[2] - 1.0); - result[7] = ( eps_sf + -x[2]); - result[8] = ( eps_sf + 0.5*x[4] + 0.5*x[1] - 1.0); - result[9] = ( eps_sf + -0.5*x[4] - 0.5*x[1]); - - if (grad) { - grad[0] = 0.0; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 1.0; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = -1.0; - grad[9] = 0.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = 0.0; - grad[14] = -1.0; - grad[15] = 1.0 - x[1]; - grad[16] = 1.0 - x[0]; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = x[1] - 1.0; - grad[21] = x[0]; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = -1.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = 1.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = -1.0; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.50; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.50; - grad[45] = 0.0; - grad[46] = -0.50; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = -0.50; - } - - return; -};
    - - -
    [docs]/** - local minimization for olivine -*/ -void ol_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[2] + x[0] - 1.0); - result[1] = ( eps_sf + x[2] - x[0]); - result[2] = ( eps_sf + -x[1]*x[0] + x[1] + x[2] + x[0] - 1.0); - result[3] = ( eps_sf + x[1]*x[0] - x[2] - x[0]); - result[4] = ( eps_sf + -x[1]); - - if (grad) { - grad[0] = 1.0; - grad[1] = 0.0; - grad[2] = -1.0; - grad[3] = -1.0; - grad[4] = 0.0; - grad[5] = 1.0; - grad[6] = 1.0 - x[1]; - grad[7] = 1.0 - x[0]; - grad[8] = 1.0; - grad[9] = x[1] - 1.0; - grad[10] = x[0]; - grad[11] = -1.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for orthopyroxene -*/ -void opx_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[7]*x[3] - x[7]*x[0] + x[7] + x[3]*x[5] - x[3]*x[1] + x[3] + x[5]*x[0] - x[5] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[7]*x[3] + x[7]*x[0] - x[3]*x[5] + x[3]*x[1] - x[3] - x[5]*x[0] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + x[6] + x[4] - x[7] + 2.0*x[5] - x[1]); - result[3] = ( eps_sf + -x[4]); - result[4] = ( eps_sf + -x[6]); - result[5] = ( eps_sf + -x[5]); - result[6] = ( eps_sf + -x[2]*x[0] + x[2] + x[7]*x[3] - x[7]*x[0] + x[7] - x[3]*x[5] + x[3]*x[1] - x[3] + x[0] - 1.0); - result[7] = ( eps_sf + x[2]*x[0] - x[7]*x[3] + x[7]*x[0] + x[3]*x[5] - x[3]*x[1] + x[3] - x[0]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -x[7]); - result[10] = ( eps_sf + 0.5*x[1] - 1.0); - result[11] = ( eps_sf + -0.5*x[1]); - - if (grad) { - grad[0] = -x[7] + x[5] - x[1] + 1.0; - grad[1] = -x[3] - x[0] + 1.0; - grad[2] = 0.0; - grad[3] = -x[7] + x[5] - x[1] + 1.0; - grad[4] = 0.0; - grad[5] = x[3] + x[0] - 1.0; - grad[6] = 0.0; - grad[7] = -x[3] - x[0] + 1.0; - grad[8] = x[7] - x[5] + x[1] - 1.0; - grad[9] = x[3] + x[0]; - grad[10] = 0.0; - grad[11] = x[7] - x[5] + x[1] - 1.0; - grad[12] = 0.0; - grad[13] = -x[3] - x[0]; - grad[14] = 0.0; - grad[15] = x[3] + x[0]; - grad[16] = 0.0; - grad[17] = -1.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 1.0; - grad[21] = 2.0; - grad[22] = 1.0; - grad[23] = -1.0; - grad[24] = 0.0; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = -1.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = -1.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = -x[2] - x[7] + 1.0; - grad[49] = x[3]; - grad[50] = 1.0 - x[0]; - grad[51] = x[7] - x[5] + x[1] - 1.0; - grad[52] = 0.0; - grad[53] = -x[3]; - grad[54] = 0.0; - grad[55] = x[3] - x[0] + 1.0; - grad[56] = x[2] + x[7] - 1.0; - grad[57] = -x[3]; - grad[58] = x[0]; - grad[59] = -x[7] + x[5] - x[1] + 1.0; - grad[60] = 0.0; - grad[61] = x[3]; - grad[62] = 0.0; - grad[63] = -x[3] + x[0]; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -1.0; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - grad[70] = 0.0; - grad[71] = 0.0; - grad[72] = 0.0; - grad[73] = 0.0; - grad[74] = 0.0; - grad[75] = 0.0; - grad[76] = 0.0; - grad[77] = 0.0; - grad[78] = 0.0; - grad[79] = -1.0; - grad[80] = 0.0; - grad[81] = 0.50; - grad[82] = 0.0; - grad[83] = 0.0; - grad[84] = 0.0; - grad[85] = 0.0; - grad[86] = 0.0; - grad[87] = 0.0; - grad[88] = 0.0; - grad[89] = -0.50; - grad[90] = 0.0; - grad[91] = 0.0; - grad[92] = 0.0; - grad[93] = 0.0; - grad[94] = 0.0; - grad[95] = 0.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for felsdpar -*/ -void pl4T_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + -x[0]); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + -0.25*x[0] - 0.25); - result[4] = ( eps_sf + 0.25*x[0] - 0.75); - - if (grad) { - grad[0] = 1.0; - grad[1] = 1.0; - grad[2] = -1.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.0; - grad[6] = -0.250; - grad[7] = 0.0; - grad[8] = 0.250; - grad[9] = 0.0; - } - - return; -};
    - - -
    [docs]/** - local minimization for spinel -*/ -void spn_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *SS_ref_db){ - result[0] = ( eps_sf + 1./3.*x[0]*x[3] + 1./3.*x[0] - 1./3.*x[3] - 2./3.*x[4] - 1./3.); - result[1] = ( eps_sf + -1./3.*x[0]*x[3] - 1./3.*x[0] - 2./3.*x[5]); - result[2] = ( eps_sf + -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + 1./3.*x[3] + 2./3.*x[4] + 2./3.*x[5] + 2./3.*x[6] - 2./3.); - result[3] = ( eps_sf + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] - 2./3.*x[6]); - result[4] = ( eps_sf + 1./3.*x[0]*x[3] + 1./3.*x[0] - 1./3.*x[3] + 1./3.*x[4] - 1./3.); - result[5] = ( eps_sf + -1./3.*x[0]*x[3] - 1./3.*x[0] + 1./3.*x[5]); - result[6] = ( eps_sf + -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + x[2] + 0.833333333333333*x[3] - 1./3.*x[4] - 1./3.*x[5] - 1./3.*x[6] - 2./3.); - result[7] = ( eps_sf + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] + 1./3.*x[6]); - result[8] = ( eps_sf + -x[2]); - result[9] = ( eps_sf + -0.5*x[3]); - - if (grad) { - grad[0] = 1./3.*x[3] + 1./3.; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = 1./3.*x[0] - 1./3.; - grad[4] = -2./3.; - grad[5] = 0.0; - grad[6] = 0.0; - grad[7] = -1./3.*x[3] - 1./3.; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = -1./3.*x[0]; - grad[11] = 0.0; - grad[12] = -2./3.; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = -2./3.*x[2] - 2./3.*x[3] + 2./3.; - grad[16] = -2./3.*x[1]; - grad[17] = 1./3. - 2./3.*x[1]; - grad[18] = 2./3.; - grad[19] = 2./3.; - grad[20] = 2./3.; - grad[21] = 0.0; - grad[22] = 2./3.*x[2] + 2./3.*x[3] - 2./3.; - grad[23] = 2./3.*x[1]; - grad[24] = 2./3.*x[1]; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = -2./3.; - grad[28] = 1./3.*x[3] + 1./3.; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = 1./3.*x[0] - 1./3.; - grad[32] = 1./3.; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = -1./3.*x[3] - 1./3.; - grad[36] = 0.0; - grad[37] = 0.0; - grad[38] = -1./3.*x[0]; - grad[39] = 0.0; - grad[40] = 1./3.; - grad[41] = 0.0; - grad[42] = 0.0; - grad[43] = -2./3.*x[2] - 2./3.*x[3] + 2./3.; - grad[44] = 1.0 - 2./3.*x[1]; - grad[45] = 0.833333333333333 - 2./3.*x[1]; - grad[46] = -1./3.; - grad[47] = -1./3.; - grad[48] = -1./3.; - grad[49] = 0.0; - grad[50] = 2./3.*x[2] + 2./3.*x[3] - 2./3.; - grad[51] = 2./3.*x[1]; - grad[52] = 2./3.*x[1]; - grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 1./3.; - grad[56] = 0.0; - grad[57] = 0.0; - grad[58] = -1.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = 0.0; - grad[62] = 0.0; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = 0.0; - grad[66] = -0.50; - grad[67] = 0.0; - grad[68] = 0.0; - grad[69] = 0.0; - } - - return; -};
    - -
    [docs]/** - local minimization for biotite -*/ -void bi_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[2]*x[0] + x[2] + 2.0/3.0*x[4] - x[3]*x[0] + x[3] - x[0]*x[1] + x[0] + x[1] - 1.0); - result[1] = ( eps_sf + x[2]*x[0] - 2.0/3.0*x[4] + x[3]*x[0] + x[0]*x[1] - x[0]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[3]); - result[4] = ( eps_sf + -x[1]); - result[5] = ( eps_sf + -1.0/3.0*x[4] + x[0] - 1.0); - result[6] = ( eps_sf + 1.0/3.0*x[4] - x[0]); - result[7] = ( eps_sf + 0.5*x[2] + 0.5*x[1] - 0.5); - result[8] = ( eps_sf + -0.5*x[2] - 0.5*x[1] - 0.5); - result[9] = ( eps_sf + x[3] - 1.0); - result[10] = ( eps_sf + -x[3]); - - if (grad) { - grad[0] = -x[2] - x[3] - x[1] + 1.0; - grad[1] = 1.0 - x[0]; - grad[2] = 1.0 - x[0]; - grad[3] = 1.0 - x[0]; - grad[4] = 2.0/3.0; - grad[5] = x[2] + x[3] + x[1] - 1.0; - grad[6] = x[0]; - grad[7] = x[0]; - grad[8] = x[0]; - grad[9] = -2.0/3.0; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = -1.0; - grad[13] = 0.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = -1.0; - grad[19] = 0.0; - grad[20] = 0.0; - grad[21] = -1.0; - grad[22] = 0.0; - grad[23] = 0.0; - grad[24] = 0.0; - grad[25] = 1.0; - grad[26] = 0.0; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = -1.0/3.0; - grad[30] = -1.0; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 1.0/3.0; - grad[35] = 0.0; - grad[36] = 0.5; - grad[37] = 0.5; - grad[38] = 0.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = -0.5; - grad[42] = -0.5; - grad[43] = 0.0; - grad[44] = 0.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 1.0; - grad[49] = 0.0; - grad[50] = 0.0; - grad[51] = 0.0; - grad[52] = 0.0; - grad[53] = -1.0; - grad[54] = 0.0; - } - - return; -};
    - -
    [docs]/** - local minimization for cordierite -*/ -void cd_ig_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); - result[2] = ( eps_sf + -x[1]); - result[3] = ( eps_sf + x[1] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 0.0; - grad[2] = 1.0; - grad[3] = 0.0; - grad[4] = 0.0; - grad[5] = -1.0; - grad[6] = 0.0; - grad[7] = 1.0; - } - - return; -};
    - - - -//--------------------------------------------------------------------------- -//---------------------------------Evans&Frost,2021-------------------------- -//--------------------------------------------------------------------------- - - -
    [docs]/** - Inequality constraints for fluid -*/ -void fluid_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]); - result[1] = ( eps_sf + x[0] - 1.0); - - if (grad) { - grad[0] = -1.0; - grad[1] = 1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for ol -*/ -void ol_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - 1.0); - result[1] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 1.0; - grad[1] = -1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for br -*/ -void br_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - 1.0); - result[1] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 1.0; - grad[1] = -1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for ch -*/ -void ch_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - 1.0); - result[1] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 1.0; - grad[1] = -1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for atg -*/ -void atg_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1]*x[3] + x[1] + x[2]*x[3] + x[2] -x[3] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] -x[1]*x[3] -x[2]*x[3] + x[3]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[1]); - result[4] = ( eps_sf + x[0] - 0.5*x[1]*x[3] - 0.5*x[2]*x[3] + 0.5*x[3] - 1.0); - result[5] = ( eps_sf + -x[0] + 0.5*x[1]*x[3] + 0.5*x[2]*x[3] - 0.5*x[3]); - result[6] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 1.0); - result[7] = ( eps_sf + -0.5*x[1] - 0.5*x[2]); - - if (grad) { - grad[0] = -x[1] -x[2] + 1.0; - grad[1] = -x[0] + x[3] + 1.0; - grad[2] = -x[0] + x[3] + 1.0; - grad[3] = x[1] + x[2] - 1.0; - grad[4] = x[1] + x[2] - 1.0; - grad[5] = x[0] -x[3]; - grad[6] = x[0] -x[3]; - grad[7] = -x[1] -x[2] + 1.0; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = -1.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 1.0; - grad[17] = -0.5*x[3]; - grad[18] = -0.5*x[3]; - grad[19] = -0.5*x[1] - 0.5*x[2] + 0.5; - grad[20] = -1.0; - grad[21] = 0.5*x[3]; - grad[22] = 0.5*x[3]; - grad[23] = 0.5*x[1] + 0.5*x[2] - 0.5; - grad[24] = 0.0; - grad[25] = 0.50; - grad[26] = 0.50; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = -0.50; - grad[30] = -0.50; - grad[31] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for g -*/ -void g_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - 1.0); - result[1] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 1.0; - grad[1] = -1.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for ta -*/ -void ta_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[3] + x[0] + x[3]*x[4] + x[3] -x[4] - 1.0); - result[1] = ( eps_sf + x[0]*x[3] -x[0] -x[3]*x[4] + x[4]); - result[2] = ( eps_sf + -x[3]); - result[3] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1] + x[2] - 0.5*x[3]*x[4] + 0.5*x[4] - 1.0); - result[4] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] + 0.5*x[3]*x[4] - 0.5*x[4]); - result[5] = ( eps_sf + -x[2]); - result[6] = ( eps_sf + -x[1]); - result[7] = ( eps_sf + x[1] + x[2] -x[3] - 1.0); - result[8] = ( eps_sf + -x[1] -x[2] + x[3]); - - if (grad) { - grad[0] = 1.0 -x[3]; - grad[1] = 0.0; - grad[2] = 0.0; - grad[3] = -x[0] + x[4] + 1.0; - grad[4] = x[3] - 1.0; - grad[5] = x[3] - 1.0; - grad[6] = 0.0; - grad[7] = 0.0; - grad[8] = x[0] -x[4]; - grad[9] = 1.0 -x[3]; - grad[10] = 0.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = -x[1] -x[2] + 1.0; - grad[16] = 1.0 -x[0]; - grad[17] = 1.0 -x[0]; - grad[18] = -0.5*x[4]; - grad[19] = 0.5 - 0.5*x[3]; - grad[20] = x[1] + x[2] - 1.0; - grad[21] = x[0]; - grad[22] = x[0]; - grad[23] = 0.5*x[4]; - grad[24] = 0.5*x[3] - 0.5; - grad[25] = 0.0; - grad[26] = 0.0; - grad[27] = -1.0; - grad[28] = 0.0; - grad[29] = 0.0; - grad[30] = 0.0; - grad[31] = -1.0; - grad[32] = 0.0; - grad[33] = 0.0; - grad[34] = 0.0; - grad[35] = 0.0; - grad[36] = 1.0; - grad[37] = 1.0; - grad[38] = -1.0; - grad[39] = 0.0; - grad[40] = 0.0; - grad[41] = -1.0; - grad[42] = -1.0; - grad[43] = 1.0; - grad[44] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for chl -*/ -void chl_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] + x[0]*x[3] + x[0] + x[1]*x[4] + x[1] -x[3]*x[4] -x[3] -x[4] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] -x[0]*x[3] -x[0] -x[1]*x[4] + x[3]*x[4] + x[4]); - result[2] = ( eps_sf + -x[1] + x[3]); - result[3] = ( eps_sf + x[0] - 0.25*x[1]*x[4] - 0.25*x[1]*x[5] - 0.25*x[2]*x[5] + 0.25*x[3]*x[4] - 0.25*x[3]*x[5] + 0.25*x[4] + 0.25*x[5] - 1.0); - result[4] = ( eps_sf + -x[0] + 0.25*x[1]*x[4] + 0.25*x[1]*x[5] + 0.25*x[2]*x[5] - 0.25*x[3]*x[4] + 0.25*x[3]*x[5] - 0.25*x[4] - 0.25*x[5]); - result[5] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] -x[0]*x[3] + x[0] + x[1]*x[5] + x[1] + x[2]*x[5] + x[2] + x[3]*x[5] + x[3] -x[5] - 1.0); - result[6] = ( eps_sf + x[0]*x[1] + x[0]*x[2] + x[0]*x[3] -x[0] -x[1]*x[5] -x[2]*x[5] -x[3]*x[5] + x[5]); - result[7] = ( eps_sf + -x[2]); - result[8] = ( eps_sf + -x[1] -x[3]); - result[9] = ( eps_sf + x[1] + 0.5*x[2] - 1.0); - result[10] = ( eps_sf + -x[1] - 0.5*x[2]); - - if (grad) { - grad[0] = -x[1] + x[3] + 1.0; - grad[1] = -x[0] + x[4] + 1.0; - grad[2] = 0.0; - grad[3] = x[0] -x[4] - 1.0; - grad[4] = x[1] -x[3] - 1.0; - grad[5] = 0.0; - grad[6] = x[1] -x[3] - 1.0; - grad[7] = x[0] -x[4]; - grad[8] = 0.0; - grad[9] = -x[0] + x[4]; - grad[10] = -x[1] + x[3] + 1.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = 1.0; - grad[16] = 0.0; - grad[17] = 0.0; - grad[18] = 1.0; - grad[19] = -0.25*x[4] - 0.25*x[5]; - grad[20] = -0.25*x[5]; - grad[21] = 0.25*x[4] - 0.25*x[5]; - grad[22] = -0.25*x[1] + 0.25*x[3] + 0.25; - grad[23] = -0.25*x[1] - 0.25*x[2] - 0.25*x[3] + 0.25; - grad[24] = -1.0; - grad[25] = 0.25*x[4] + 0.25*x[5]; - grad[26] = 0.25*x[5]; - grad[27] = -0.25*x[4] + 0.25*x[5]; - grad[28] = 0.25*x[1] - 0.25*x[3] - 0.25; - grad[29] = 0.25*x[1] + 0.25*x[2] + 0.25*x[3] - 0.25; - grad[30] = -x[1] -x[2] -x[3] + 1.0; - grad[31] = -x[0] + x[5] + 1.0; - grad[32] = -x[0] + x[5] + 1.0; - grad[33] = -x[0] + x[5] + 1.0; - grad[34] = 0.0; - grad[35] = x[1] + x[2] + x[3] - 1.0; - grad[36] = x[1] + x[2] + x[3] - 1.0; - grad[37] = x[0] -x[5]; - grad[38] = x[0] -x[5]; - grad[39] = x[0] -x[5]; - grad[40] = 0.0; - grad[41] = -x[1] -x[2] -x[3] + 1.0; - grad[42] = 0.0; - grad[43] = 0.0; - grad[44] = -1.0; - grad[45] = 0.0; - grad[46] = 0.0; - grad[47] = 0.0; - grad[48] = 0.0; - grad[49] = -1.0; - grad[50] = 0.0; - grad[51] = -1.0; - grad[52] = 0.0; - grad[53] = 0.0; - grad[54] = 0.0; - grad[55] = 1.0; - grad[56] = 0.50; - grad[57] = 0.0; - grad[58] = 0.0; - grad[59] = 0.0; - grad[60] = 0.0; - grad[61] = -1.0; - grad[62] = -0.50; - grad[63] = 0.0; - grad[64] = 0.0; - grad[65] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for anth -*/ -void anth_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - x[1]*x[3] + 1.5*x[2] + x[3] - 1.0); - result[1] = ( eps_sf + -x[0] + x[1]*x[3] - 1.5*x[2] - x[3]); - result[2] = ( eps_sf + x[0] - x[2] - 1.0); - result[3] = ( eps_sf + -x[0] + x[2]); - result[4] = ( eps_sf + -x[1]); - result[5] = ( eps_sf + -x[0]*x[1] + x[0] + x[1]*x[3] + x[1] - x[3] - 1.0); - result[6] = ( eps_sf + x[0]*x[1] - x[0] - x[1]*x[3] + x[3]); - result[7] = ( eps_sf + -0.5*x[1]); - result[8] = ( eps_sf + 0.5*x[1] - 1.0); - - if (grad) { - grad[0] = 1.0; - grad[1] = -x[3]; - grad[2] = 1.5; - grad[3] = 1.0 - x[1]; - grad[4] = -1.0; - grad[5] = x[3]; - grad[6] = -1.5; - grad[7] = x[1] - 1.0; - grad[8] = 1.0; - grad[9] = 0.0; - grad[10] = -1.0; - grad[11] = 0.0; - grad[12] = -1.0; - grad[13] = 0.0; - grad[14] = 1.0; - grad[15] = 0.0; - grad[16] = 0.0; - grad[17] = -1.0; - grad[18] = 0.0; - grad[19] = 0.0; - grad[20] = 1.0 - x[1]; - grad[21] = -x[0] + x[3] + 1.0; - grad[22] = 0.0; - grad[23] = x[1] - 1.0; - grad[24] = x[1] - 1.0; - grad[25] = x[0] - x[3]; - grad[26] = 0.0; - grad[27] = 1.0 - x[1]; - grad[28] = 0.0; - grad[29] = -0.50; - grad[30] = 0.0; - grad[31] = 0.0; - grad[32] = 0.0; - grad[33] = 0.50; - grad[34] = 0.0; - grad[35] = 0.0; - } - - return; -};
    - - -
    [docs]/** - Inequality constraints for spi -*/ -void spi_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[1]); - result[1] = ( eps_sf + x[1] - 1.0); - result[2] = ( eps_sf + x[0] - 1.0); - result[3] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 0.0; - grad[1] = -1.0; - grad[2] = 0.0; - grad[3] = 1.0; - grad[4] = 1.0; - grad[5] = 0.0; - grad[6] = -1.0; - grad[7] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for opx -*/ -void opx_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1] + x[2] - 0.5*x[3] - 1.0); - result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] + 0.5*x[3]); - result[2] = ( eps_sf + -x[2]); - result[3] = ( eps_sf + -x[1]); - result[4] = ( eps_sf + x[0] + 0.5*x[3] - 1.0); - result[5] = ( eps_sf + -x[0] - 0.5*x[3]); - result[6] = ( eps_sf + -0.5*x[1] - 0.5*x[2]); - result[7] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 1.0); - - if (grad) { - grad[0] = -x[1] -x[2] + 1.0; - grad[1] = 1.0 -x[0]; - grad[2] = 1.0 -x[0]; - grad[3] = -0.50; - grad[4] = x[1] + x[2] - 1.0; - grad[5] = x[0]; - grad[6] = x[0]; - grad[7] = 0.50; - grad[8] = 0.0; - grad[9] = 0.0; - grad[10] = -1.0; - grad[11] = 0.0; - grad[12] = 0.0; - grad[13] = -1.0; - grad[14] = 0.0; - grad[15] = 0.0; - grad[16] = 1.0; - grad[17] = 0.0; - grad[18] = 0.0; - grad[19] = 0.50; - grad[20] = -1.0; - grad[21] = 0.0; - grad[22] = 0.0; - grad[23] = -0.50; - grad[24] = 0.0; - grad[25] = -0.50; - grad[26] = -0.50; - grad[27] = 0.0; - grad[28] = 0.0; - grad[29] = 0.50; - grad[30] = 0.50; - grad[31] = 0.0; - } - - return; -};
    - -
    [docs]/** - Inequality constraints for po -*/ -void po_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ - result[0] = ( eps_sf + x[0] - 1.0); - result[1] = ( eps_sf + -x[0]); - - if (grad) { - grad[0] = 1.0; - grad[1] = -1.0; - } - - return; -};
    - -
    typedef struct global_min_datas { -
    global_variable gv;
    -
    bulk_info z_b;
    -
    obj_type *SS_objective;
    -
    sf_type *SS_sf;
    -
    PP_ref *PP_ref_db;
    -
    SS_ref *SS_ref_db;
    -
    csd_phase_set *cp;
    - -} global_min_data;
    - - -
    SS_ref NLopt_opt_alk_liq_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_liq, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, liq_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_liq(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_fl_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_fl, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, fl_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_fl(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_fsp_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_fsp, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, fsp_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_fsp(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_spn_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_spn, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, spn_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_spn(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_g_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_g, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, g_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_g(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_ol_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_ol, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ol_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_ol(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_opx_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_opx, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, opx_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_opx(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_cpx_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_cpx, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, cpx_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_cpx(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_ilm_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_ilm, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ilm_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_ilm(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_ness_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_ness, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ness_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_ness(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_lct_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_lct, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, lct_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_lct(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_kals_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_kals, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, kals_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_kals(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_mel_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_mel, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, mel_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_mel(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_hb_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_hb, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, hb_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_hb(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_bi_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_bi, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, bi_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_bi(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_ep_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_ep, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ep_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_ep(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_alk_cd_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_alk_cd, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, cd_alk_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_alk_cd(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    - - -
    SS_ref NLopt_opt_igd_liq_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_liq, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, liq_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_liq(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_fl_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_fl, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, fl_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_fl(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_fsp_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_fsp, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, fsp_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_fsp(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_spn_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_spn, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, spn_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_spn(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_g_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_g, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, g_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_g(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_ol_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_ol, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ol_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_ol(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_opx_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_opx, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, opx_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_opx(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_cpx_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_cpx, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, cpx_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_cpx(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_ilm_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_ilm, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ilm_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_ilm(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_hb_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_hb, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, hb_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_hb(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_bi_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_bi, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, bi_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_bi(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_igd_ep_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; + grad[27] = 1.0 - x[1]; + grad[28] = 0.0; + grad[29] = -0.50; + grad[30] = 0.0; + grad[31] = 0.0; + grad[32] = 0.0; + grad[33] = 0.50; + grad[34] = 0.0; + grad[35] = 0.0; } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_ep, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, ep_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_ep(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; + return; };
    -
    SS_ref NLopt_opt_igd_cd_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_igd_cd, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, cd_igd_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - nlopt_set_maxtime(SS_ref_db.opt, gv.maxgmTime); - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_igd_cd(n, x, NULL, &SS_ref_db); + +
    [docs]/** + Inequality constraints for spi +*/ +void spi_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[1]); + result[1] = ( eps_sf + x[1] - 1.0); + result[2] = ( eps_sf + x[0] - 1.0); + result[3] = ( eps_sf + -x[0]); + + if (grad) { + grad[0] = 0.0; + grad[1] = -1.0; + grad[2] = 0.0; + grad[3] = 1.0; + grad[4] = 1.0; + grad[5] = 0.0; + grad[6] = -1.0; + grad[7] = 0.0; } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); + + return; +};
    + +
    [docs]/** + Inequality constraints for opx +*/ +void opx_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + -x[0]*x[1] -x[0]*x[2] + x[0] + x[1] + x[2] - 0.5*x[3] - 1.0); + result[1] = ( eps_sf + x[0]*x[1] + x[0]*x[2] -x[0] + 0.5*x[3]); + result[2] = ( eps_sf + -x[2]); + result[3] = ( eps_sf + -x[1]); + result[4] = ( eps_sf + x[0] + 0.5*x[3] - 1.0); + result[5] = ( eps_sf + -x[0] - 0.5*x[3]); + result[6] = ( eps_sf + -0.5*x[1] - 0.5*x[2]); + result[7] = ( eps_sf + 0.5*x[1] + 0.5*x[2] - 1.0); + + if (grad) { + grad[0] = -x[1] -x[2] + 1.0; + grad[1] = 1.0 -x[0]; + grad[2] = 1.0 -x[0]; + grad[3] = -0.50; + grad[4] = x[1] + x[2] - 1.0; + grad[5] = x[0]; + grad[6] = x[0]; + grad[7] = 0.50; + grad[8] = 0.0; + grad[9] = 0.0; + grad[10] = -1.0; + grad[11] = 0.0; + grad[12] = 0.0; + grad[13] = -1.0; + grad[14] = 0.0; + grad[15] = 0.0; + grad[16] = 1.0; + grad[17] = 0.0; + grad[18] = 0.0; + grad[19] = 0.50; + grad[20] = -1.0; + grad[21] = 0.0; + grad[22] = 0.0; + grad[23] = -0.50; + grad[24] = 0.0; + grad[25] = -0.50; + grad[26] = -0.50; + grad[27] = 0.0; + grad[28] = 0.0; + grad[29] = 0.50; + grad[30] = 0.50; + grad[31] = 0.0; } - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; + + return; +};
    + +
    [docs]/** + Inequality constraints for po +*/ +void po_um_c(unsigned m, double *result, unsigned n, const double *x, double *grad, void *data){ + result[0] = ( eps_sf + x[0] - 1.0); + result[1] = ( eps_sf + -x[0]); + + if (grad) { + grad[0] = 1.0; + grad[1] = -1.0; } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; + + return; };
    +
    typedef struct global_min_datas { +
    global_variable gv;
    +
    bulk_info z_b;
    +
    obj_type *SS_objective;
    +
    sf_type *SS_sf;
    +
    PP_ref *PP_ref_db;
    +
    SS_ref *SS_ref_db;
    +
    csd_phase_set *cp;
    + +} global_min_data;
    + +
    SS_ref NLopt_opt_mp_st_function(global_variable gv, SS_ref SS_ref_db){ int n_em = SS_ref_db.n_em; @@ -7348,6 +3480,47 @@

    Source code for NLopt_opt_function.c

         return SS_ref_db;
     };
    +
    SS_ref NLopt_opt_ig_fper_function(global_variable gv, SS_ref SS_ref_db){ + + int n_em = SS_ref_db.n_em; + unsigned int n = SS_ref_db.n_xeos; + unsigned int m = SS_ref_db.n_sf; + + double *x = SS_ref_db.iguess; + + for (int i = 0; i < (SS_ref_db.n_xeos); i++){ + SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; + SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; + } + + SS_ref_db.opt = nlopt_create(NLOPT_LD_CCSAQ, (n)); + nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); + nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); + nlopt_set_min_objective(SS_ref_db.opt, obj_ig_fper, &SS_ref_db); + nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, fper_ig_c, NULL, SS_ref_db.tol_sf); + nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); + nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); + + double minf; + if (gv.maxeval==1){ + // we are only interested in evaluating the objective function + minf = obj_ig_fper(n, x, NULL, &SS_ref_db); + } + else{ + // do optimization + SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); + } + /* Send back needed local solution parameters */ + for (int i = 0; i < SS_ref_db.n_xeos; i++){ + SS_ref_db.xeos[i] = x[i]; + } + + SS_ref_db.df = minf; + nlopt_destroy(SS_ref_db.opt); + + return SS_ref_db; +};
    +
    SS_ref NLopt_opt_ig_bi_function(global_variable gv, SS_ref SS_ref_db){ int n_em = SS_ref_db.n_em; @@ -7725,48 +3898,6 @@

    Source code for NLopt_opt_function.c

        return SS_ref_db;
     };
    -
    SS_ref NLopt_opt_ig_mu_function(global_variable gv, SS_ref SS_ref_db){ - - int n_em = SS_ref_db.n_em; - unsigned int n = SS_ref_db.n_xeos; - unsigned int m = SS_ref_db.n_sf; - - double *x = SS_ref_db.iguess; - - for (int i = 0; i < (SS_ref_db.n_xeos); i++){ - SS_ref_db.lb[i] = SS_ref_db.bounds[i][0]; - SS_ref_db.ub[i] = SS_ref_db.bounds[i][1]; - } - - SS_ref_db.opt = nlopt_create(NLOPT_LD_SLSQP, (n)); - nlopt_set_lower_bounds(SS_ref_db.opt, SS_ref_db.lb); - nlopt_set_upper_bounds(SS_ref_db.opt, SS_ref_db.ub); - nlopt_set_min_objective(SS_ref_db.opt, obj_ig_mu, &SS_ref_db); - nlopt_add_inequality_mconstraint(SS_ref_db.opt, m, mu_ig_c, NULL, SS_ref_db.tol_sf); - nlopt_set_ftol_rel(SS_ref_db.opt, gv.obj_tol); - nlopt_set_maxeval(SS_ref_db.opt, gv.maxeval); - - double minf; - if (gv.maxeval==1){ - // we are only interested in evaluating the objective function - minf = obj_ig_mu(n, x, NULL, &SS_ref_db); - } - else{ - // do optimization - SS_ref_db.status = nlopt_optimize(SS_ref_db.opt, x, &minf); - } - - /* Send back needed local solution parameters */ - for (int i = 0; i < SS_ref_db.n_xeos; i++){ - SS_ref_db.xeos[i] = x[i]; - } - - SS_ref_db.df = minf; - nlopt_destroy(SS_ref_db.opt); - - return SS_ref_db; -};
    -
    SS_ref NLopt_opt_ig_ol_function(global_variable gv, SS_ref SS_ref_db){ int n_em = SS_ref_db.n_em; @@ -8498,6 +4629,8 @@

    Source code for NLopt_opt_function.c

       else if(gv.EM_database == 2){          // igneous
         if 		(strcmp( gv.SS_list[index], "bi") == 0 ){
           SS_ref_db  = NLopt_opt_ig_bi_function( gv, SS_ref_db);	}
    +    else if (strcmp( gv.SS_list[index], "fper")  == 0){
    +      SS_ref_db  = NLopt_opt_ig_fper_function( gv, SS_ref_db);	}
         else if (strcmp( gv.SS_list[index], "cd")  == 0){
           SS_ref_db  = NLopt_opt_ig_cd_function( gv, SS_ref_db);	}
         else if (strcmp( gv.SS_list[index], "cpx") == 0){
    @@ -8514,8 +4647,6 @@ 

    Source code for NLopt_opt_function.c

           SS_ref_db  = NLopt_opt_ig_ilm_function( gv, SS_ref_db);}
         else if (strcmp( gv.SS_list[index], "liq") == 0){
           SS_ref_db  = NLopt_opt_ig_liq_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "mu")  == 0){
    -      SS_ref_db  = NLopt_opt_ig_mu_function( gv, SS_ref_db);	}	
         else if (strcmp( gv.SS_list[index], "ol")  == 0){
           SS_ref_db  = NLopt_opt_ig_ol_function( gv, SS_ref_db);	}
         else if (strcmp( gv.SS_list[index], "opx") == 0){
    @@ -8529,76 +4660,6 @@ 

    Source code for NLopt_opt_function.c

           printf("\nsolid solution '%s index %d' is not in the database\n",gv.SS_list[index], index);	
           }	
       }
    -  else if (gv.EM_database == 3){
    -    if (strcmp( gv.SS_list[index], "liq")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_liq_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "fl")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_fl_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "fsp")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_fsp_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "spn")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_spn_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "g")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_g_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "ol")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_ol_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "opx")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_opx_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "cpx")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_cpx_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "ilm")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_ilm_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "hb")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_hb_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "bi")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_bi_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "ep")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_ep_function( gv, SS_ref_db);}
    -    else if (strcmp( gv.SS_list[index], "cd")  == 0){
    -        SS_ref_db  = NLopt_opt_igd_cd_function( gv, SS_ref_db);}
    -    else{
    -        printf("\nsolid solution '%s index %d' is not in the database\n",gv.SS_list[index], index);
    -    }
    -  }
    -  else if (gv.EM_database == 6){
    -      if (strcmp( gv.SS_list[index], "liq")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_liq_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "fl")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_fl_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "fsp")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_fsp_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "spn")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_spn_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "g")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_g_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "ol")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_ol_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "opx")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_opx_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "cpx")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_cpx_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "ilm")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_ilm_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "ness")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_ness_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "lct")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_lct_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "kals")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_kals_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "mel")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_mel_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "hb")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_hb_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "bi")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_bi_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "ep")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_ep_function( gv, SS_ref_db);}
    -      else if (strcmp( gv.SS_list[index], "cd")  == 0){
    -          SS_ref_db  = NLopt_opt_alk_cd_function( gv, SS_ref_db);}
    -      else{
    -          printf("\nsolid solution '%s index %d' is not in the database\n",gv.SS_list[index], index);
    -      }
    -    }
       else if (gv.EM_database == 4){
           if (strcmp( gv.SS_list[index], "fluid")  == 0){
              SS_ref_db  = NLopt_opt_um_fluid_function( gv, SS_ref_db);}
    diff --git a/docs/_modules/PGE_function.c.html b/docs/_modules/PGE_function.c.html
    index 1db8f608..4c53341f 100644
    --- a/docs/_modules/PGE_function.c.html
    +++ b/docs/_modules/PGE_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -913,6 +922,7 @@

    Source code for PGE_function.c

     		// Solution (with transpose!)
     		char T = 'T';
     		dgetrs(						&T,
    +
     									&nEntry, 
     									&nrhs, 
     									gv.A_PGE,
    diff --git a/docs/_modules/dump_function.c.html b/docs/_modules/dump_function.c.html
    index 25288b47..9f2d87a8 100644
    --- a/docs/_modules/dump_function.c.html
    +++ b/docs/_modules/dump_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/_modules/gem_function.c.html b/docs/_modules/gem_function.c.html index 03c53253..2fa0e314 100644 --- a/docs/_modules/gem_function.c.html +++ b/docs/_modules/gem_function.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/_modules/gss_function.c.html b/docs/_modules/gss_function.c.html index 1d04cfcf..c240d75f 100644 --- a/docs/_modules/gss_function.c.html +++ b/docs/_modules/gss_function.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -311,4186 +320,14 @@

    Source code for gss_function.c

     	em_data data; 
     	PP_ref PP_db   		= G_EM_function(EM_database, len_ox, z_b.id, z_b.bulk_rock, z_b.apo, P, T, name, state);
        	data.ElShearMod  	= PP_db.phase_shearModulus;
    -   	data.gb  			= PP_db.gbase;
    -
    -	for (int i = 0; i < len_ox; i++){
    -		data.C[i] = PP_db.Comp[i];
    -	}
    -	return data;
    -}
    - -/**************************************************************************************/ -/**************************************************************************************/ -/*******************IGNEOUS ALKALINE DATABASE (Weller et al., 2023)********************/ -/**************************************************************************************/ -/**************************************************************************************/ - -
    [docs]/** - retrieve reference thermodynamic data for alk_liq -*/ -SS_ref G_SS_alk_liq_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"q3L","sl1L","wo1L","fo2L","fa2L","nmL","hmL","ekL","tiL","kmL","anL","ab1L","enL","kfL","wat1L"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 16.1 - 0.1*SS_ref_db.P; - SS_ref_db.W[1] = 6.800; - SS_ref_db.W[2] = 44.1 - 0.5*SS_ref_db.P; - SS_ref_db.W[3] = -0.52*SS_ref_db.P - 4.7; - SS_ref_db.W[4] = 1.100; - SS_ref_db.W[5] = 10.70; - SS_ref_db.W[6] = -5.500; - SS_ref_db.W[7] = 0.4*SS_ref_db.P + 12.1; - SS_ref_db.W[8] = 0.96*SS_ref_db.P + 7.0; - SS_ref_db.W[9] = 0.02*SS_ref_db.P - 6.7; - SS_ref_db.W[10] = -0.1000; - SS_ref_db.W[11] = 22.7 - 0.41*SS_ref_db.P; - SS_ref_db.W[12] = -0.48*SS_ref_db.P - 10.2; - SS_ref_db.W[13] = 13.0 - 1.19*SS_ref_db.P; - SS_ref_db.W[14] = 0.85*SS_ref_db.P - 24.6; - SS_ref_db.W[15] = 5.7 - 0.15*SS_ref_db.P; - SS_ref_db.W[16] = 1.600; - SS_ref_db.W[17] = -0.01*SS_ref_db.P - 12.4; - SS_ref_db.W[18] = -6.000; - SS_ref_db.W[19] = -2.000; - SS_ref_db.W[20] = 5.400; - SS_ref_db.W[21] = 0.07*SS_ref_db.P - 33.0; - SS_ref_db.W[22] = 1.000; - SS_ref_db.W[23] = -0.05*SS_ref_db.P - 10.1; - SS_ref_db.W[24] = 8.300; - SS_ref_db.W[25] = 4.800; - SS_ref_db.W[26] = 24.2 - 1.03*SS_ref_db.P; - SS_ref_db.W[27] = 40.50; - SS_ref_db.W[28] = 16.00; - SS_ref_db.W[29] = 2.7 - 0.14*SS_ref_db.P; - SS_ref_db.W[30] = -2.500; - SS_ref_db.W[31] = -11.00; - SS_ref_db.W[32] = 9.700; - SS_ref_db.W[33] = 1.4 - 0.07*SS_ref_db.P; - SS_ref_db.W[34] = 6.500; - SS_ref_db.W[35] = -2.500; - SS_ref_db.W[36] = 0.09*SS_ref_db.P + 18.3; - SS_ref_db.W[37] = 13.60; - SS_ref_db.W[38] = 34.1 - 0.77*SS_ref_db.P; - SS_ref_db.W[39] = 17.7 - 0.21*SS_ref_db.P; - SS_ref_db.W[40] = 16.9 - 0.12*SS_ref_db.P; - SS_ref_db.W[41] = -2.500; - SS_ref_db.W[42] = -3.000; - SS_ref_db.W[43] = -0.16*SS_ref_db.P - 6.0; - SS_ref_db.W[44] = 0.69*SS_ref_db.P + 26.0; - SS_ref_db.W[45] = -4.900; - SS_ref_db.W[46] = 12.90; - SS_ref_db.W[47] = 0.2*SS_ref_db.P + 1.0; - SS_ref_db.W[48] = -1.200; - SS_ref_db.W[49] = 10.3 - 1.75*SS_ref_db.P; - SS_ref_db.W[50] = 4.100; - SS_ref_db.W[51] = -31.00; - SS_ref_db.W[52] = -1.000; - SS_ref_db.W[53] = -6.000; - SS_ref_db.W[54] = 16.90; - SS_ref_db.W[55] = -5.800; - SS_ref_db.W[56] = 7.300; - SS_ref_db.W[57] = 3.800; - SS_ref_db.W[58] = -4.900; - SS_ref_db.W[59] = 11.8 - 1.83*SS_ref_db.P; - SS_ref_db.W[60] = 12.50; - SS_ref_db.W[61] = -2.000; - SS_ref_db.W[62] = 0.14*SS_ref_db.P + 9.9; - SS_ref_db.W[63] = -0.02*SS_ref_db.P - 8.5; - SS_ref_db.W[64] = -9.200; - SS_ref_db.W[65] = 0.13*SS_ref_db.P - 1.1; - SS_ref_db.W[66] = 1.400; - SS_ref_db.W[67] = -7.500; - SS_ref_db.W[68] = 1.97*SS_ref_db.P - 50.8; - SS_ref_db.W[69] = -1.500; - SS_ref_db.W[70] = -7.100; - SS_ref_db.W[71] = 8.300; - SS_ref_db.W[72] = -1.500; - SS_ref_db.W[73] = -1.000; - SS_ref_db.W[74] = -1.700; - SS_ref_db.W[75] = -1.500; - SS_ref_db.W[76] = 57.9 - 0.66*SS_ref_db.P; - SS_ref_db.W[77] = -2.500; - SS_ref_db.W[78] = 0.0; - SS_ref_db.W[79] = 0.5000; - SS_ref_db.W[80] = -2.000; - SS_ref_db.W[81] = -2.000; - SS_ref_db.W[82] = -1.500; - SS_ref_db.W[83] = 30.0 - 0.66*SS_ref_db.P; - SS_ref_db.W[84] = 4.800; - SS_ref_db.W[85] = -8.700; - SS_ref_db.W[86] = -1.800; - SS_ref_db.W[87] = 6.400; - SS_ref_db.W[88] = -10.00; - SS_ref_db.W[89] = 28.8 - 0.6*SS_ref_db.P; - SS_ref_db.W[90] = 17.70; - SS_ref_db.W[91] = 19.80; - SS_ref_db.W[92] = -1.200; - SS_ref_db.W[93] = 0.46*SS_ref_db.P + 29.8; - SS_ref_db.W[94] = 2.55*SS_ref_db.P - 62.2; - SS_ref_db.W[95] = -4.100; - SS_ref_db.W[96] = 0.5000; - SS_ref_db.W[97] = 12.90; - SS_ref_db.W[98] = 0.19*SS_ref_db.P - 73.3; - SS_ref_db.W[99] = 0.4000; - SS_ref_db.W[100] = 23.50; - SS_ref_db.W[101] = -0.62*SS_ref_db.P - 18.8; - SS_ref_db.W[102] = 0.3000; - SS_ref_db.W[103] = 5.2 - 0.17*SS_ref_db.P; - SS_ref_db.W[104] = -0.7*SS_ref_db.P - 4.1; - - SS_ref_db.v[0] = 100.0; - SS_ref_db.v[1] = 145.0; - SS_ref_db.v[2] = 145.0; - SS_ref_db.v[3] = 200.0; - SS_ref_db.v[4] = 200.0; - SS_ref_db.v[5] = 85.00; - SS_ref_db.v[6] = 50.00; - SS_ref_db.v[7] = 50.00; - SS_ref_db.v[8] = 50.00; - SS_ref_db.v[9] = 85.00; - SS_ref_db.v[10] = 100.0; - SS_ref_db.v[11] = 100.0; - SS_ref_db.v[12] = 100.0; - SS_ref_db.v[13] = 100.0; - SS_ref_db.v[14] = 87.00; - - - em_data qL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "qL", - "equilibrium" ); - - em_data corL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "corL", - "equilibrium" ); - - em_data woL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "woL", - "equilibrium" ); - - em_data foL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "foL", - "equilibrium" ); - - em_data faL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "faL", - "equilibrium" ); - - em_data neL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "neL", - "equilibrium" ); - - em_data hemL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hemL", - "equilibrium" ); - - em_data eskL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "eskL", - "equilibrium" ); - - em_data ruL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ruL", - "equilibrium" ); - - em_data ksL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ksL", - "equilibrium" ); - - em_data watL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "h2oL", - "equilibrium" ); - SS_ref_db.gbase[0] = -0.076*z_b.P + 3.0*qL_eq.gb + 0.91; - SS_ref_db.gbase[1] = -0.246*z_b.P + corL_eq.gb + qL_eq.gb - 18.68; - SS_ref_db.gbase[2] = -0.047*z_b.P + woL_eq.gb - 1.42; - SS_ref_db.gbase[3] = -0.142*z_b.P + 2.0*foL_eq.gb + 13.21; - SS_ref_db.gbase[4] = -0.041*z_b.P + 2.0*faL_eq.gb + 18.48; - SS_ref_db.gbase[5] = -0.171*z_b.P - 0.007*z_b.T - 0.5*corL_eq.gb + neL_eq.gb - 0.5*qL_eq.gb + 49.11; - SS_ref_db.gbase[6] = -0.005*z_b.P + 0.5*hemL_eq.gb + 4.03; - SS_ref_db.gbase[7] = 0.19*z_b.P + 0.5*eskL_eq.gb + 23.51; - SS_ref_db.gbase[8] = -0.228*z_b.P + ruL_eq.gb + 2.59; - SS_ref_db.gbase[9] = 0.304*z_b.P - 0.025*z_b.T - 0.5*corL_eq.gb + ksL_eq.gb - 0.5*qL_eq.gb + 72.26; - SS_ref_db.gbase[10] = 0.022*z_b.P + corL_eq.gb + qL_eq.gb + woL_eq.gb - 48.53; - SS_ref_db.gbase[11] = -0.342*z_b.P - 0.032*z_b.T + neL_eq.gb + 2.0*qL_eq.gb + 18.44; - SS_ref_db.gbase[12] = -0.338*z_b.P + foL_eq.gb + qL_eq.gb - 14.33; - SS_ref_db.gbase[13] = -0.11*z_b.P - 0.02*z_b.T + ksL_eq.gb + 2.0*qL_eq.gb + 1.24; - SS_ref_db.gbase[14] = 0.0072*z_b.P - 0.00436*z_b.T + watL_eq.gb + 11.04; - - SS_ref_db.ElShearMod[0] = 3.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = corL_eq.ElShearMod + qL_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = woL_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = 2.0*foL_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = 2.0*faL_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -0.5*corL_eq.ElShearMod + neL_eq.ElShearMod - 0.5*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = 0.5*hemL_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = 0.5*eskL_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = ruL_eq.ElShearMod; - SS_ref_db.ElShearMod[9] = -0.5*corL_eq.ElShearMod + ksL_eq.ElShearMod - 0.5*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[10] = corL_eq.ElShearMod + qL_eq.ElShearMod + woL_eq.ElShearMod; - SS_ref_db.ElShearMod[11] = neL_eq.ElShearMod + 2.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[12] = foL_eq.ElShearMod + qL_eq.ElShearMod; - SS_ref_db.ElShearMod[13] = ksL_eq.ElShearMod + 2.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[14] = watL_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = 3.0*qL_eq.C[i]; - SS_ref_db.Comp[1][i] = corL_eq.C[i] + qL_eq.C[i]; - SS_ref_db.Comp[2][i] = woL_eq.C[i]; - SS_ref_db.Comp[3][i] = 2.0*foL_eq.C[i]; - SS_ref_db.Comp[4][i] = 2.0*faL_eq.C[i]; - SS_ref_db.Comp[5][i] = -0.5*corL_eq.C[i] + neL_eq.C[i] - 0.5*qL_eq.C[i]; - SS_ref_db.Comp[6][i] = 0.5*hemL_eq.C[i]; - SS_ref_db.Comp[7][i] = 0.5*eskL_eq.C[i]; - SS_ref_db.Comp[8][i] = ruL_eq.C[i]; - SS_ref_db.Comp[9][i] = -0.5*corL_eq.C[i] + ksL_eq.C[i] - 0.5*qL_eq.C[i]; - SS_ref_db.Comp[10][i] = corL_eq.C[i] + qL_eq.C[i] + woL_eq.C[i]; - SS_ref_db.Comp[11][i] = neL_eq.C[i] + 2.0*qL_eq.C[i]; - SS_ref_db.Comp[12][i] = foL_eq.C[i] + qL_eq.C[i]; - SS_ref_db.Comp[13][i] = ksL_eq.C[i] + 2.0*qL_eq.C[i]; - SS_ref_db.Comp[14][i] = watL_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = 0.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - SS_ref_db.bounds_ref[9][0] = 0.0+eps; SS_ref_db.bounds_ref[9][1] = 1.0-eps; - SS_ref_db.bounds_ref[10][0] = 0.0+eps; SS_ref_db.bounds_ref[10][1] = 1.0-eps; - SS_ref_db.bounds_ref[11][0] = 0.0+eps; SS_ref_db.bounds_ref[11][1] = 1.0-eps; - SS_ref_db.bounds_ref[12][0] = 0.0+eps; SS_ref_db.bounds_ref[12][1] = 1.0-eps; - SS_ref_db.bounds_ref[13][0] = 0.0+eps; SS_ref_db.bounds_ref[13][1] = 1.0-eps; - - if (z_b.bulk_rock[10] == 0.){ - SS_ref_db.z_em[14] = 0.0; - SS_ref_db.bounds_ref[9][0] = eps; - SS_ref_db.bounds_ref[9][1] = eps; - } - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[7] = 0.0; - SS_ref_db.d_em[7] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[6] = 0.0; - SS_ref_db.d_em[6] = 1.0; - SS_ref_db.bounds_ref[5][0] = 0.0; - SS_ref_db.bounds_ref[5][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_fl -*/ -SS_ref G_SS_alk_fl_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"qfL","nefL","ksfL","H2O"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.04*SS_ref_db.P + 3.8; - SS_ref_db.W[1] = -0.07*SS_ref_db.P - 1.5; - SS_ref_db.W[2] = 71.1 - 0.9*SS_ref_db.P; - SS_ref_db.W[3] = 0.0; - SS_ref_db.W[4] = 71.6 - 0.82*SS_ref_db.P; - SS_ref_db.W[5] = 74.2 - 1.4*SS_ref_db.P; - - - em_data qL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "qL", - "equilibrium" ); - - em_data abL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "abL", - "equilibrium" ); - - em_data kspL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kspL", - "equilibrium" ); - - em_data H2O_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "H2O", - "equilibrium" ); - - SS_ref_db.gbase[0] = -0.422*z_b.P + 3.0*qL_eq.gb + 9.48; - SS_ref_db.gbase[1] = -0.88*z_b.P + abL_eq.gb - 2.0*qL_eq.gb + 61.24; - SS_ref_db.gbase[2] = -0.926*z_b.P + kspL_eq.gb - 2.0*qL_eq.gb + 54.32; - SS_ref_db.gbase[3] = H2O_eq.gb; - - SS_ref_db.ElShearMod[0] = 3.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = abL_eq.ElShearMod - 2.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = kspL_eq.ElShearMod - 2.0*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = H2O_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = 3.0*qL_eq.C[i]; - SS_ref_db.Comp[1][i] = abL_eq.C[i] - 2.0*qL_eq.C[i]; - SS_ref_db.Comp[2][i] = kspL_eq.C[i] - 2.0*qL_eq.C[i]; - SS_ref_db.Comp[3][i] = H2O_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_fsp -*/ -SS_ref G_SS_alk_fsp_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"ab","an","san"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = -0.04*SS_ref_db.P - 0.00935*SS_ref_db.T + 14.6; - SS_ref_db.W[1] = 0.338*SS_ref_db.P - 0.00957*SS_ref_db.T + 24.1; - SS_ref_db.W[2] = 48.5 - 0.13*SS_ref_db.P; - - SS_ref_db.v[0] = 0.6740; - SS_ref_db.v[1] = 0.5500; - SS_ref_db.v[2] = 1.000; - - - em_data ab_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ab", - "equilibrium" ); - - em_data an_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "an", - "equilibrium" ); - - em_data san_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "san", - "equilibrium" ); - - SS_ref_db.gbase[0] = ab_eq.gb; - SS_ref_db.gbase[1] = an_eq.gb; - SS_ref_db.gbase[2] = san_eq.gb; - - SS_ref_db.ElShearMod[0] = ab_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = an_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = san_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ab_eq.C[i]; - SS_ref_db.Comp[1][i] = an_eq.C[i]; - SS_ref_db.Comp[2][i] = san_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 3.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_spn -*/ -SS_ref G_SS_alk_spn_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"nsp","isp","nhc","ihc","nmt","imt","pcr","usp"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = -6.700; - SS_ref_db.W[1] = 3.600; - SS_ref_db.W[2] = -9.800; - SS_ref_db.W[3] = 43.20; - SS_ref_db.W[4] = 49.50; - SS_ref_db.W[5] = -0.08*SS_ref_db.P - 38.4; - SS_ref_db.W[6] = 40.00; - SS_ref_db.W[7] = 2.700; - SS_ref_db.W[8] = -3.500; - SS_ref_db.W[9] = 36.80; - SS_ref_db.W[10] = 20.70; - SS_ref_db.W[11] = -0.08*SS_ref_db.P - 21.6; - SS_ref_db.W[12] = 38.20; - SS_ref_db.W[13] = -6.000; - SS_ref_db.W[14] = 17.50; - SS_ref_db.W[15] = 51.60; - SS_ref_db.W[16] = -53.80; - SS_ref_db.W[17] = 25.70; - SS_ref_db.W[18] = -4.100; - SS_ref_db.W[19] = 10.00; - SS_ref_db.W[20] = -38.80; - SS_ref_db.W[21] = 21.00; - SS_ref_db.W[22] = 18.10; - SS_ref_db.W[23] = 12.10; - SS_ref_db.W[24] = 5.200; - SS_ref_db.W[25] = -8.700; - SS_ref_db.W[26] = 21.50; - SS_ref_db.W[27] = 15.00; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.000; - SS_ref_db.v[3] = 1.000; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - SS_ref_db.v[6] = 1.000; - SS_ref_db.v[7] = 0.9000; - - - em_data sp_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "sp", - "ordered" ); - - em_data herc_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "herc", - "ordered" ); - - em_data mt_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mt", - "equilibrium" ); - - em_data picr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "picr", - "equilibrium" ); - - em_data usp_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "usp", - "equilibrium" ); - - SS_ref_db.gbase[0] = sp_or.gb; - SS_ref_db.gbase[1] = -0.005763*z_b.T + sp_or.gb + 23.5; - SS_ref_db.gbase[2] = herc_or.gb; - SS_ref_db.gbase[3] = -0.005763*z_b.T + herc_or.gb + 23.6; - SS_ref_db.gbase[4] = 0.005763*z_b.T + mt_eq.gb; - SS_ref_db.gbase[5] = mt_eq.gb + 0.3; - SS_ref_db.gbase[6] = picr_eq.gb; - SS_ref_db.gbase[7] = usp_eq.gb; - - SS_ref_db.ElShearMod[0] = sp_or.ElShearMod; - SS_ref_db.ElShearMod[1] = sp_or.ElShearMod; - SS_ref_db.ElShearMod[2] = herc_or.ElShearMod; - SS_ref_db.ElShearMod[3] = herc_or.ElShearMod; - SS_ref_db.ElShearMod[4] = mt_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = mt_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = picr_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = usp_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = sp_or.C[i]; - SS_ref_db.Comp[1][i] = sp_or.C[i]; - SS_ref_db.Comp[2][i] = herc_or.C[i]; - SS_ref_db.Comp[3][i] = herc_or.C[i]; - SS_ref_db.Comp[4][i] = mt_eq.C[i]; - SS_ref_db.Comp[5][i] = mt_eq.C[i]; - SS_ref_db.Comp[6][i] = picr_eq.C[i]; - SS_ref_db.Comp[7][i] = usp_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -1.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = -1.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = -1.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[6] = 0.0; - SS_ref_db.d_em[6] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - SS_ref_db.bounds_ref[1][0] = 0.0; - SS_ref_db.bounds_ref[1][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_g -*/ -SS_ref G_SS_alk_g_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"py","alm","gr","andr","knr","tig"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.1*SS_ref_db.P + 4.0; - SS_ref_db.W[1] = 0.04*SS_ref_db.P - 0.01*SS_ref_db.T + 45.4; - SS_ref_db.W[2] = -0.036*SS_ref_db.P - 0.01*SS_ref_db.T + 107.0; - SS_ref_db.W[3] = 2.000; - SS_ref_db.W[4] = 1.000; - SS_ref_db.W[5] = 0.1*SS_ref_db.P - 0.01*SS_ref_db.T + 17.0; - SS_ref_db.W[6] = 0.039*SS_ref_db.P - 0.01*SS_ref_db.T + 65.0; - SS_ref_db.W[7] = 0.01*SS_ref_db.P + 8.2; - SS_ref_db.W[8] = 0.0; - SS_ref_db.W[9] = 2.000; - SS_ref_db.W[10] = 0.18*SS_ref_db.P - 0.01*SS_ref_db.T + 5.0; - SS_ref_db.W[11] = -3.000; - SS_ref_db.W[12] = 0.1*SS_ref_db.P - 0.01*SS_ref_db.T + 63.0; - SS_ref_db.W[13] = -1.000; - SS_ref_db.W[14] = 0.0; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 2.500; - SS_ref_db.v[3] = 2.500; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - - - em_data py_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "py", - "equilibrium" ); - - em_data alm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "alm", - "equilibrium" ); - - em_data gr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gr", - "equilibrium" ); - - em_data andr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "andr", - "equilibrium" ); - - em_data knor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "knor", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - SS_ref_db.gbase[0] = py_eq.gb; - SS_ref_db.gbase[1] = alm_eq.gb; - SS_ref_db.gbase[2] = gr_eq.gb; - SS_ref_db.gbase[3] = andr_eq.gb; - SS_ref_db.gbase[4] = knor_eq.gb; - SS_ref_db.gbase[5] = -0.0173*z_b.T - 0.5*cor_eq.gb + 0.5*per_eq.gb + py_eq.gb + 0.5*ru_eq.gb + 42.3; - - SS_ref_db.ElShearMod[0] = py_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = alm_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = gr_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = andr_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = knor_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -0.5*cor_eq.ElShearMod + 0.5*per_eq.ElShearMod + py_eq.ElShearMod + 0.5*ru_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = py_eq.C[i]; - SS_ref_db.Comp[1][i] = alm_eq.C[i]; - SS_ref_db.Comp[2][i] = gr_eq.C[i]; - SS_ref_db.Comp[3][i] = andr_eq.C[i]; - SS_ref_db.Comp[4][i] = knor_eq.C[i]; - SS_ref_db.Comp[5][i] = -0.5*cor_eq.C[i] + 0.5*per_eq.C[i] + py_eq.C[i] + 0.5*ru_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.bounds_ref[3][0] = 0.0; - SS_ref_db.bounds_ref[3][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[3] = 0.0; - SS_ref_db.d_em[3] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_ol -*/ -SS_ref G_SS_alk_ol_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"mnt","fa","fo","cfm"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 24.00; - SS_ref_db.W[1] = 38.00; - SS_ref_db.W[2] = 24.00; - SS_ref_db.W[3] = 9.000; - SS_ref_db.W[4] = 4.500; - SS_ref_db.W[5] = 4.500; - - - em_data mont_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mont", - "equilibrium" ); - - em_data fa_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fa", - "equilibrium" ); - - em_data fo_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fo", - "equilibrium" ); - - SS_ref_db.gbase[0] = mont_eq.gb; - SS_ref_db.gbase[1] = fa_eq.gb; - SS_ref_db.gbase[2] = fo_eq.gb; - SS_ref_db.gbase[3] = 0.5*fa_eq.gb + 0.5*fo_eq.gb; - - SS_ref_db.ElShearMod[0] = mont_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fa_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = fo_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = 0.5*fa_eq.ElShearMod + 0.5*fo_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = mont_eq.C[i]; - SS_ref_db.Comp[1][i] = fa_eq.C[i]; - SS_ref_db.Comp[2][i] = fo_eq.C[i]; - SS_ref_db.Comp[3][i] = 0.5*fa_eq.C[i] + 0.5*fo_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = -0.5+eps; SS_ref_db.bounds_ref[2][1] = 0.5-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_opx -*/ -SS_ref G_SS_alk_opx_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"en","fs","fm","odi","mgts","cren","obuf","mess","ojd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 7.000; - SS_ref_db.W[1] = 3.500; - SS_ref_db.W[2] = 0.15*SS_ref_db.P + 29.0; - SS_ref_db.W[3] = 12.5 - 0.04*SS_ref_db.P; - SS_ref_db.W[4] = 8.000; - SS_ref_db.W[5] = 6.000; - SS_ref_db.W[6] = 8.000; - SS_ref_db.W[7] = 35.00; - SS_ref_db.W[8] = 4.500; - SS_ref_db.W[9] = 0.08*SS_ref_db.P + 23.0; - SS_ref_db.W[10] = 11.0 - 0.15*SS_ref_db.P; - SS_ref_db.W[11] = 10.00; - SS_ref_db.W[12] = 7.000; - SS_ref_db.W[13] = 10.00; - SS_ref_db.W[14] = 35.00; - SS_ref_db.W[15] = 0.08*SS_ref_db.P + 19.0; - SS_ref_db.W[16] = 15.0 - 0.15*SS_ref_db.P; - SS_ref_db.W[17] = 12.00; - SS_ref_db.W[18] = 8.000; - SS_ref_db.W[19] = 12.00; - SS_ref_db.W[20] = 35.00; - SS_ref_db.W[21] = 75.5 - 0.84*SS_ref_db.P; - SS_ref_db.W[22] = 20.00; - SS_ref_db.W[23] = 40.00; - SS_ref_db.W[24] = 20.00; - SS_ref_db.W[25] = 35.00; - SS_ref_db.W[26] = 2.000; - SS_ref_db.W[27] = 10.00; - SS_ref_db.W[28] = 2.000; - SS_ref_db.W[29] = 7.000; - SS_ref_db.W[30] = 6.000; - SS_ref_db.W[31] = 2.000; - SS_ref_db.W[32] = -11.00; - SS_ref_db.W[33] = 6.000; - SS_ref_db.W[34] = 20.00; - SS_ref_db.W[35] = -11.00; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.000; - SS_ref_db.v[3] = 1.200; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - SS_ref_db.v[6] = 1.000; - SS_ref_db.v[7] = 1.000; - SS_ref_db.v[8] = 1.200; - - - em_data en_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "en", - "equilibrium" ); - - em_data fs_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fs", - "equilibrium" ); - - em_data di_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "di", - "equilibrium" ); - - em_data mgts_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mgts", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - em_data kos_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kos", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - SS_ref_db.gbase[0] = en_eq.gb; - SS_ref_db.gbase[1] = fs_eq.gb; - SS_ref_db.gbase[2] = 0.5*en_eq.gb + 0.5*fs_eq.gb - 6.6; - SS_ref_db.gbase[3] = 0.005*z_b.P + di_eq.gb + 2.8; - SS_ref_db.gbase[4] = mgts_eq.gb; - SS_ref_db.gbase[5] = 0.02*z_b.P + 0.0155*z_b.T - jd_eq.gb + kos_eq.gb + mgts_eq.gb - 28.64; - SS_ref_db.gbase[6] = 0.37*z_b.P - 0.0051*z_b.T - 0.5*cor_eq.gb + mgts_eq.gb + 0.5*per_eq.gb + 0.5*ru_eq.gb - 3.91; - SS_ref_db.gbase[7] = -0.089*z_b.P + acm_eq.gb - jd_eq.gb + mgts_eq.gb - 0.07; - SS_ref_db.gbase[8] = jd_eq.gb + 18.2; - - SS_ref_db.ElShearMod[0] = en_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fs_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = 0.5*en_eq.ElShearMod + 0.5*fs_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = di_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -jd_eq.ElShearMod + kos_eq.ElShearMod + mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = -0.5*cor_eq.ElShearMod + mgts_eq.ElShearMod + 0.5*per_eq.ElShearMod + 0.5*ru_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = acm_eq.ElShearMod - jd_eq.ElShearMod + mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = en_eq.C[i]; - SS_ref_db.Comp[1][i] = fs_eq.C[i]; - SS_ref_db.Comp[2][i] = 0.5*en_eq.C[i] + 0.5*fs_eq.C[i]; - SS_ref_db.Comp[3][i] = di_eq.C[i]; - SS_ref_db.Comp[4][i] = mgts_eq.C[i]; - SS_ref_db.Comp[5][i] = -jd_eq.C[i] + kos_eq.C[i] + mgts_eq.C[i]; - SS_ref_db.Comp[6][i] = -0.5*cor_eq.C[i] + mgts_eq.C[i] + 0.5*per_eq.C[i] + 0.5*ru_eq.C[i]; - SS_ref_db.Comp[7][i] = acm_eq.C[i] - jd_eq.C[i] + mgts_eq.C[i]; - SS_ref_db.Comp[8][i] = jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 2.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = -1.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[7] = 0.0; - SS_ref_db.d_em[7] = 1.0; - SS_ref_db.bounds_ref[4][0] = 0.0; - SS_ref_db.bounds_ref[4][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_cpx -*/ -SS_ref G_SS_alk_cpx_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"di","cfs","cats","crdi","cess","cbuf","jd","cen","cfm","kjd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 25.8 - 0.03*SS_ref_db.P; - SS_ref_db.W[1] = 13.0 - 0.06*SS_ref_db.P; - SS_ref_db.W[2] = 8.000; - SS_ref_db.W[3] = 8.000; - SS_ref_db.W[4] = 8.000; - SS_ref_db.W[5] = 26.00; - SS_ref_db.W[6] = 29.8 - 0.03*SS_ref_db.P; - SS_ref_db.W[7] = 20.6 - 0.03*SS_ref_db.P; - SS_ref_db.W[8] = 26.00; - SS_ref_db.W[9] = 25.0 - 0.1*SS_ref_db.P; - SS_ref_db.W[10] = 38.30; - SS_ref_db.W[11] = 43.30; - SS_ref_db.W[12] = 24.00; - SS_ref_db.W[13] = 24.00; - SS_ref_db.W[14] = 2.300; - SS_ref_db.W[15] = 3.500; - SS_ref_db.W[16] = 24.00; - SS_ref_db.W[17] = 2.000; - SS_ref_db.W[18] = 2.000; - SS_ref_db.W[19] = 6.000; - SS_ref_db.W[20] = 6.000; - SS_ref_db.W[21] = 45.2 - 0.35*SS_ref_db.P; - SS_ref_db.W[22] = 27.0 - 0.1*SS_ref_db.P; - SS_ref_db.W[23] = 6.000; - SS_ref_db.W[24] = 2.000; - SS_ref_db.W[25] = 6.000; - SS_ref_db.W[26] = 3.000; - SS_ref_db.W[27] = 52.30; - SS_ref_db.W[28] = 40.30; - SS_ref_db.W[29] = 3.000; - SS_ref_db.W[30] = 6.000; - SS_ref_db.W[31] = 3.000; - SS_ref_db.W[32] = 57.30; - SS_ref_db.W[33] = 45.30; - SS_ref_db.W[34] = 3.000; - SS_ref_db.W[35] = 16.00; - SS_ref_db.W[36] = 24.00; - SS_ref_db.W[37] = 22.00; - SS_ref_db.W[38] = 16.00; - SS_ref_db.W[39] = 40.00; - SS_ref_db.W[40] = 26.00; - SS_ref_db.W[41] = 28.00; - SS_ref_db.W[42] = 4.000; - SS_ref_db.W[43] = 40.00; - SS_ref_db.W[44] = 40.00; - - SS_ref_db.v[0] = 1.200; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.900; - SS_ref_db.v[3] = 1.900; - SS_ref_db.v[4] = 1.900; - SS_ref_db.v[5] = 1.900; - SS_ref_db.v[6] = 1.200; - SS_ref_db.v[7] = 1.000; - SS_ref_db.v[8] = 1.000; - SS_ref_db.v[9] = 1.200; - - - em_data di_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "di", - "equilibrium" ); - - em_data fs_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fs", - "equilibrium" ); - - em_data cats_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cats", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - em_data kos_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kos", - "equilibrium" ); - - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - em_data en_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "en", - "equilibrium" ); - - em_data abh_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "abh", - "equilibrium" ); - - em_data san_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "san", - "equilibrium" ); - - SS_ref_db.gbase[0] = di_eq.gb; - SS_ref_db.gbase[1] = 0.045*z_b.P - 0.002*z_b.T + fs_eq.gb + 2.1; - SS_ref_db.gbase[2] = cats_eq.gb; - SS_ref_db.gbase[3] = cats_eq.gb - jd_eq.gb + kos_eq.gb + 4.85; - SS_ref_db.gbase[4] = acm_eq.gb + cats_eq.gb - jd_eq.gb - 3.46; - SS_ref_db.gbase[5] = 0.248*z_b.P - 0.0012*z_b.T - 0.5*cor_eq.gb + cats_eq.gb + 0.5*per_eq.gb + 0.5*ru_eq.gb - 20.89; - SS_ref_db.gbase[6] = jd_eq.gb; - SS_ref_db.gbase[7] = 0.048*z_b.P - 0.002*z_b.T + en_eq.gb + 3.5; - SS_ref_db.gbase[8] = 0.0465*z_b.P - 0.002*z_b.T + 0.5*en_eq.gb + 0.5*fs_eq.gb - 1.6; - SS_ref_db.gbase[9] = 0.6*z_b.P - abh_eq.gb + san_eq.gb + jd_eq.gb + 10.82; - - SS_ref_db.ElShearMod[0] = di_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fs_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = cats_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = cats_eq.ElShearMod - jd_eq.ElShearMod + kos_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = acm_eq.ElShearMod + cats_eq.ElShearMod - jd_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -0.5*cor_eq.ElShearMod + cats_eq.ElShearMod + 0.5*per_eq.ElShearMod + 0.5*ru_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = jd_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = en_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = 0.5*en_eq.ElShearMod + 0.5*fs_eq.ElShearMod; - SS_ref_db.ElShearMod[9] = -abh_eq.ElShearMod + san_eq.ElShearMod + jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = di_eq.C[i]; - SS_ref_db.Comp[1][i] = fs_eq.C[i]; - SS_ref_db.Comp[2][i] = cats_eq.C[i]; - SS_ref_db.Comp[3][i] = cats_eq.C[i] - jd_eq.C[i] + kos_eq.C[i]; - SS_ref_db.Comp[4][i] = acm_eq.C[i] + cats_eq.C[i] - jd_eq.C[i]; - SS_ref_db.Comp[5][i] = -0.5*cor_eq.C[i] + cats_eq.C[i] + 0.5*per_eq.C[i] + 0.5*ru_eq.C[i]; - SS_ref_db.Comp[6][i] = jd_eq.C[i]; - SS_ref_db.Comp[7][i] = en_eq.C[i]; - SS_ref_db.Comp[8][i] = 0.5*en_eq.C[i] + 0.5*fs_eq.C[i]; - SS_ref_db.Comp[9][i] = -abh_eq.C[i] + san_eq.C[i] + jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 2.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -1.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = 0.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[3] = 0.0; - SS_ref_db.d_em[3] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.bounds_ref[5][0] = 0.0; - SS_ref_db.bounds_ref[5][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_ilm -*/ -SS_ref G_SS_alk_ilm_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"oilm","dilm","hm","ogk","dgk"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.13*SS_ref_db.P + 7.05; - SS_ref_db.W[1] = 14.30; - SS_ref_db.W[2] = -7.600; - SS_ref_db.W[3] = 0.6000; - SS_ref_db.W[4] = 7.25 - 0.13*SS_ref_db.P; - SS_ref_db.W[5] = -5.500; - SS_ref_db.W[6] = -2.200; - SS_ref_db.W[7] = 12.50; - SS_ref_db.W[8] = 2.700; - SS_ref_db.W[9] = 8.300; - - - em_data ilm_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ilm", - "ordered" ); - - em_data ilm_di = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ilm", - "disordered" ); - - em_data hem_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hem", - "equilibrium" ); - - em_data geik_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "geik", - "ordered" ); - - em_data geik_di = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "geik", - "disordered" ); - - SS_ref_db.gbase[0] = ilm_or.gb; - SS_ref_db.gbase[1] = ilm_di.gb; - SS_ref_db.gbase[2] = hem_eq.gb; - SS_ref_db.gbase[3] = geik_or.gb; - SS_ref_db.gbase[4] = geik_di.gb; - - SS_ref_db.ElShearMod[0] = ilm_or.ElShearMod; - SS_ref_db.ElShearMod[1] = ilm_di.ElShearMod; - SS_ref_db.ElShearMod[2] = hem_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = geik_or.ElShearMod; - SS_ref_db.ElShearMod[4] = geik_di.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ilm_or.C[i]; - SS_ref_db.Comp[1][i] = ilm_di.C[i]; - SS_ref_db.Comp[2][i] = hem_eq.C[i]; - SS_ref_db.Comp[3][i] = geik_or.C[i]; - SS_ref_db.Comp[4][i] = geik_di.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = -1.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = -1.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[2] = 0.0; - SS_ref_db.d_em[2] = 1.0; - SS_ref_db.bounds_ref[0][0] = 1.0; - SS_ref_db.bounds_ref[0][1] = 1.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_ness -*/ -SS_ref G_SS_alk_ness_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"neN","neS","neK","neO","neC","neF"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 21.9 - 0.92*SS_ref_db.P; - SS_ref_db.W[1] = 112.8 - 0.03*SS_ref_db.P; - SS_ref_db.W[2] = 11.4 - 0.03*SS_ref_db.P; - SS_ref_db.W[3] = 22.00; - SS_ref_db.W[4] = 0.0; - SS_ref_db.W[5] = 79.70; - SS_ref_db.W[6] = 25.20; - SS_ref_db.W[7] = 5.000; - SS_ref_db.W[8] = 23.00; - SS_ref_db.W[9] = 0.17*SS_ref_db.P + 59.4; - SS_ref_db.W[10] = 100.0; - SS_ref_db.W[11] = 80.00; - SS_ref_db.W[12] = 50.00; - SS_ref_db.W[13] = 13.00; - SS_ref_db.W[14] = 27.00; - - SS_ref_db.v[0] = 1.18700000000000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.000; - SS_ref_db.v[3] = 0.9950; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - - - em_data ne_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ne", - "equilibrium" ); - - em_data trd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "trd", - "equilibrium" ); - - em_data kls_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kls", - "equilibrium" ); - - em_data an_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "an", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - SS_ref_db.gbase[0] = 0.004*z_b.T + 4.0*ne_eq.gb + 0.45; - SS_ref_db.gbase[1] = -0.145*z_b.P + 0.002*z_b.T + 3.0*ne_eq.gb + 2.0*trd_eq.gb - 20.6; - SS_ref_db.gbase[2] = 0.008*z_b.P - 0.0005*z_b.T + 4.0*kls_eq.gb + 1.2; - SS_ref_db.gbase[3] = -0.07*z_b.P + 3.0*ne_eq.gb + kls_eq.gb - 1.1; - SS_ref_db.gbase[4] = an_eq.gb + 2.0*ne_eq.gb; - SS_ref_db.gbase[5] = 4.0*acm_eq.gb + 4.0*ne_eq.gb - 4.0*jd_eq.gb + 167.0; - - SS_ref_db.ElShearMod[0] = 4.0*ne_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = 3.0*ne_eq.ElShearMod + 2.0*trd_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = 4.0*kls_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = 3.0*ne_eq.ElShearMod + kls_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = an_eq.ElShearMod + 2.0*ne_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = 4.0*acm_eq.ElShearMod + 4.0*ne_eq.ElShearMod - 4.0*jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = 4.0*ne_eq.C[i]; - SS_ref_db.Comp[1][i] = 3.0*ne_eq.C[i] + 2.0*trd_eq.C[i]; - SS_ref_db.Comp[2][i] = 4.0*kls_eq.C[i]; - SS_ref_db.Comp[3][i] = 3.0*ne_eq.C[i] + kls_eq.C[i]; - SS_ref_db.Comp[4][i] = an_eq.C[i] + 2.0*ne_eq.C[i]; - SS_ref_db.Comp[5][i] = 4.0*acm_eq.C[i] + 4.0*ne_eq.C[i] - 4.0*jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = -1.0/3.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[3][0] = 0.0; - SS_ref_db.bounds_ref[3][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_lct -*/ -SS_ref G_SS_alk_lct_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"nlc","klc"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 14.50; - - SS_ref_db.v[0] = 0.9500; - SS_ref_db.v[1] = 1.000; - - - em_data ab_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ab", - "equilibrium" ); - - em_data lc_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "lc", - "equilibrium" ); - - em_data san_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "san", - "equilibrium" ); - - SS_ref_db.gbase[0] = ab_eq.gb + lc_eq.gb - san_eq.gb + 16.6; - SS_ref_db.gbase[1] = lc_eq.gb; - - SS_ref_db.ElShearMod[0] = ab_eq.ElShearMod + lc_eq.ElShearMod - san_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = lc_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ab_eq.C[i] + lc_eq.C[i] - san_eq.C[i]; - SS_ref_db.Comp[1][i] = lc_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_kals -*/ -SS_ref G_SS_alk_kals_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"nks","kls"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 14.4 - 0.06*SS_ref_db.P; - - SS_ref_db.v[0] = 1.23500000000000; - SS_ref_db.v[1] = 1.000; - - - em_data ne_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ne", - "equilibrium" ); - - em_data kls_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kls", - "equilibrium" ); - - SS_ref_db.gbase[0] = -0.115*z_b.P + 0.0025*z_b.T + ne_eq.gb + 3.17; - SS_ref_db.gbase[1] = kls_eq.gb; - - SS_ref_db.ElShearMod[0] = ne_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = kls_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ne_eq.C[i]; - SS_ref_db.Comp[1][i] = kls_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_mel -*/ -SS_ref G_SS_alk_mel_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"geh","ak","fak","nml","fge"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 15.00; - SS_ref_db.W[1] = 13.50; - SS_ref_db.W[2] = 1.000; - SS_ref_db.W[3] = 0.0; - SS_ref_db.W[4] = 0.0; - SS_ref_db.W[5] = 0.0; - SS_ref_db.W[6] = 15.00; - SS_ref_db.W[7] = 13.50; - SS_ref_db.W[8] = 13.50; - SS_ref_db.W[9] = 1.000; - - - em_data geh_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "geh", - "equilibrium" ); - - em_data ak_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ak", - "equilibrium" ); - - em_data sp_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "sp", - "ordered" ); - - em_data herc_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "herc", - "ordered" ); - - em_data ab_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ab", - "equilibrium" ); - - em_data an_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "an", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - SS_ref_db.gbase[0] = geh_eq.gb; - SS_ref_db.gbase[1] = ak_eq.gb; - SS_ref_db.gbase[2] = ak_eq.gb + herc_or.gb - sp_or.gb + 4.05; - SS_ref_db.gbase[3] = ab_eq.gb - an_eq.gb + geh_eq.gb - 25.14; - SS_ref_db.gbase[4] = acm_eq.gb + geh_eq.gb - jd_eq.gb + 7.81; - - SS_ref_db.ElShearMod[0] = geh_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ak_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = ak_eq.ElShearMod + herc_or.ElShearMod - sp_or.ElShearMod; - SS_ref_db.ElShearMod[3] = ab_eq.ElShearMod - an_eq.ElShearMod + geh_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = acm_eq.ElShearMod + geh_eq.ElShearMod - jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = geh_eq.C[i]; - SS_ref_db.Comp[1][i] = ak_eq.C[i]; - SS_ref_db.Comp[2][i] = ak_eq.C[i] + herc_or.C[i] - sp_or.C[i]; - SS_ref_db.Comp[3][i] = ab_eq.C[i] - an_eq.C[i] + geh_eq.C[i]; - SS_ref_db.Comp[4][i] = acm_eq.C[i] + geh_eq.C[i] - jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.bounds_ref[3][0] = 0.0; - SS_ref_db.bounds_ref[3][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_hb -*/ -SS_ref G_SS_alk_hb_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"tr","tsm","prgm","glm","cumm","grnm","a","b","mrb","kprg","tts"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 20.0; - SS_ref_db.W[1] = 25.0; - SS_ref_db.W[2] = 65.0; - SS_ref_db.W[3] = 45.0; - SS_ref_db.W[4] = 75.0; - SS_ref_db.W[5] = 57.0; - SS_ref_db.W[6] = 63.0; - SS_ref_db.W[7] = 52.0; - SS_ref_db.W[8] = 30.0; - SS_ref_db.W[9] = 85.0; - SS_ref_db.W[10] = -40.0; - SS_ref_db.W[11] = 25.0; - SS_ref_db.W[12] = 70.0; - SS_ref_db.W[13] = 80.0; - SS_ref_db.W[14] = 70.0; - SS_ref_db.W[15] = 72.5; - SS_ref_db.W[16] = 20.0; - SS_ref_db.W[17] = -40.0; - SS_ref_db.W[18] = 35.0; - SS_ref_db.W[19] = 50.0; - SS_ref_db.W[20] = 90.0; - SS_ref_db.W[21] = 106.7; - SS_ref_db.W[22] = 94.8; - SS_ref_db.W[23] = 94.8; - SS_ref_db.W[24] = 40.0; - SS_ref_db.W[25] = 8.0; - SS_ref_db.W[26] = 15.0; - SS_ref_db.W[27] = 100.0; - SS_ref_db.W[28] = 113.5; - SS_ref_db.W[29] = 100.0; - SS_ref_db.W[30] = 111.2; - SS_ref_db.W[31] = 0.0; - SS_ref_db.W[32] = 54.0; - SS_ref_db.W[33] = 75.0; - SS_ref_db.W[34] = 33.0; - SS_ref_db.W[35] = 18.0; - SS_ref_db.W[36] = 23.0; - SS_ref_db.W[37] = 80.0; - SS_ref_db.W[38] = 87.0; - SS_ref_db.W[39] = 100.0; - SS_ref_db.W[40] = 12.0; - SS_ref_db.W[41] = 8.0; - SS_ref_db.W[42] = 91.0; - SS_ref_db.W[43] = 96.0; - SS_ref_db.W[44] = 65.0; - SS_ref_db.W[45] = 20.0; - SS_ref_db.W[46] = 80.0; - SS_ref_db.W[47] = 94.0; - SS_ref_db.W[48] = 95.0; - SS_ref_db.W[49] = 90.0; - SS_ref_db.W[50] = 94.0; - SS_ref_db.W[51] = 95.0; - SS_ref_db.W[52] = 50.0; - SS_ref_db.W[53] = 50.0; - SS_ref_db.W[54] = 35.0; - - SS_ref_db.v[0] = 1.0; - SS_ref_db.v[1] = 1.5; - SS_ref_db.v[2] = 1.7; - SS_ref_db.v[3] = 0.8; - SS_ref_db.v[4] = 1.0; - SS_ref_db.v[5] = 1.0; - SS_ref_db.v[6] = 1.0; - SS_ref_db.v[7] = 1.0; - SS_ref_db.v[8] = 0.8; - SS_ref_db.v[9] = 1.7; - SS_ref_db.v[10] = 1.5; - - - em_data tr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "tr", - "equilibrium" ); - - em_data ts_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ts", - "equilibrium" ); - - em_data parg_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "parg", - "equilibrium" ); - - em_data gl_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gl", - "equilibrium" ); - - em_data cumm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cumm", - "equilibrium" ); - - em_data grun_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "grun", - "equilibrium" ); - - em_data gr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gr", - "equilibrium" ); - - em_data andr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "andr", - "equilibrium" ); - - em_data pa_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "pa", - "equilibrium" ); - - em_data mu_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mu", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data dsp_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "dsp", - "equilibrium" ); - - SS_ref_db.gbase[0] = tr_eq.gb; - SS_ref_db.gbase[1] = ts_eq.gb + 10.0; - SS_ref_db.gbase[2] = parg_eq.gb - 10.0; - SS_ref_db.gbase[3] = gl_eq.gb - 3.0; - SS_ref_db.gbase[4] = cumm_eq.gb; - SS_ref_db.gbase[5] = grun_eq.gb - 3.0; - SS_ref_db.gbase[6] = 3.0/7.0*cumm_eq.gb + 4.0/7.0*grun_eq.gb - 11.2; - SS_ref_db.gbase[7] = 2.0/7.0*cumm_eq.gb + 5.0/7.0*grun_eq.gb - 13.8; - SS_ref_db.gbase[8] = andr_eq.gb + gl_eq.gb - gr_eq.gb; - SS_ref_db.gbase[9] = 0.02*SS_ref_db.T + mu_eq.gb - pa_eq.gb + parg_eq.gb - 7.06; - SS_ref_db.gbase[10] = -2.0*dsp_eq.gb + 2.0*ru_eq.gb + ts_eq.gb + 95.0; - - SS_ref_db.ElShearMod[0] = tr_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ts_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = parg_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = gl_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = cumm_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = grun_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = 3.0/7.0*cumm_eq.ElShearMod + 4.0/7.0*grun_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = 2.0/7.0*cumm_eq.ElShearMod + 5.0/7.0*grun_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = andr_eq.ElShearMod + gl_eq.ElShearMod - gr_eq.ElShearMod; - SS_ref_db.ElShearMod[9] = mu_eq.ElShearMod - pa_eq.ElShearMod + parg_eq.ElShearMod; - SS_ref_db.ElShearMod[10] = -2.0*dsp_eq.ElShearMod + 2.0*ru_eq.ElShearMod + ts_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = tr_eq.C[i]; - SS_ref_db.Comp[1][i] = ts_eq.C[i]; - SS_ref_db.Comp[2][i] = parg_eq.C[i]; - SS_ref_db.Comp[3][i] = gl_eq.C[i]; - SS_ref_db.Comp[4][i] = cumm_eq.C[i]; - SS_ref_db.Comp[5][i] = grun_eq.C[i]; - SS_ref_db.Comp[6][i] = 3.0/7.0*cumm_eq.C[i] + 4.0/7.0*grun_eq.C[i]; - SS_ref_db.Comp[7][i] = 2.0/7.0*cumm_eq.C[i] + 5.0/7.0*grun_eq.C[i]; - SS_ref_db.Comp[8][i] = andr_eq.C[i] + gl_eq.C[i] - gr_eq.C[i]; - SS_ref_db.Comp[9][i] = mu_eq.C[i] - pa_eq.C[i] + parg_eq.C[i]; - SS_ref_db.Comp[10][i] = -2.0*dsp_eq.C[i] + 2.0*ru_eq.C[i] + ts_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = -1.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - SS_ref_db.bounds_ref[9][0] = -1.0+eps; SS_ref_db.bounds_ref[9][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[8] = 0.0; - SS_ref_db.d_em[8] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_bi -*/ -SS_ref G_SS_alk_bi_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"phl","annm","obi","eas","tbi","fbi"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 12.00; - SS_ref_db.W[1] = 4.000; - SS_ref_db.W[2] = 10.00; - SS_ref_db.W[3] = 30.00; - SS_ref_db.W[4] = 14.00; - SS_ref_db.W[5] = 8.000; - SS_ref_db.W[6] = 0.0; - SS_ref_db.W[7] = 32.00; - SS_ref_db.W[8] = 4.000; - SS_ref_db.W[9] = 7.000; - SS_ref_db.W[10] = 24.00; - SS_ref_db.W[11] = 7.000; - SS_ref_db.W[12] = 40.00; - SS_ref_db.W[13] = 1.000; - SS_ref_db.W[14] = 40.00; - - - em_data phl_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "phl", - "equilibrium" ); - - em_data ann_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ann", - "equilibrium" ); - - em_data east_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "east", - "equilibrium" ); - - em_data br_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "br", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - SS_ref_db.gbase[0] = phl_eq.gb; - SS_ref_db.gbase[1] = ann_eq.gb - 3.0; - SS_ref_db.gbase[2] = 1.0/3.0*ann_eq.gb + 2.0/3.0*phl_eq.gb - 6.0; - SS_ref_db.gbase[3] = east_eq.gb + 2.2; - SS_ref_db.gbase[4] = -br_eq.gb + phl_eq.gb + ru_eq.gb + 55.0; - SS_ref_db.gbase[5] = acm_eq.gb + east_eq.gb - jd_eq.gb -7.2; - - SS_ref_db.ElShearMod[0] = phl_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ann_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = 1.0/3.0*ann_eq.ElShearMod + 2.0/3.0*phl_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = east_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = -br_eq.ElShearMod + phl_eq.ElShearMod + ru_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = acm_eq.ElShearMod + east_eq.ElShearMod - jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = phl_eq.C[i]; - SS_ref_db.Comp[1][i] = ann_eq.C[i]; - SS_ref_db.Comp[2][i] = 1.0/3.0*ann_eq.C[i] + 2.0/3.0*phl_eq.C[i]; - SS_ref_db.Comp[3][i] = east_eq.C[i]; - SS_ref_db.Comp[4][i] = -br_eq.C[i] + phl_eq.C[i] + ru_eq.C[i]; - SS_ref_db.Comp[5][i] = acm_eq.C[i] + east_eq.C[i] - jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -0.75+eps; SS_ref_db.bounds_ref[4][1] = 0.75-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_ep -*/ -SS_ref G_SS_alk_ep_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"cz","ep","fep"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 1.000; - SS_ref_db.W[1] = 3.000; - SS_ref_db.W[2] = 1.000; - - - em_data cz_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cz", - "equilibrium" ); - - em_data ep_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ep", - "equilibrium" ); - - em_data fep_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fep", - "equilibrium" ); - - SS_ref_db.gbase[0] = cz_eq.gb; - SS_ref_db.gbase[1] = ep_eq.gb; - SS_ref_db.gbase[2] = fep_eq.gb; - - SS_ref_db.ElShearMod[0] = cz_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ep_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = fep_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = cz_eq.C[i]; - SS_ref_db.Comp[1][i] = ep_eq.C[i]; - SS_ref_db.Comp[2][i] = fep_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = -0.5+eps; SS_ref_db.bounds_ref[1][1] = 0.5-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.bounds_ref[0][0] = 0.0; - SS_ref_db.bounds_ref[0][1] = 0.0; - SS_ref_db.bounds_ref[1][0] = 0.0; - SS_ref_db.bounds_ref[1][1] = 0.0; - SS_ref_db.z_em[1] = 0.0; - SS_ref_db.d_em[1] = 1.0; - SS_ref_db.z_em[2] = 0.0; - SS_ref_db.d_em[2] = 1.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for alk_cd -*/ -SS_ref G_SS_alk_cd_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"crd","fcrd","hcrd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 2.500; - SS_ref_db.W[1] = 0.0; - - - em_data crd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "crd", - "equilibrium" ); - - em_data fcrd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fcrd", - "equilibrium" ); - - em_data hcrd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hcrd", - "equilibrium" ); - - SS_ref_db.gbase[0] = crd_eq.gb; - SS_ref_db.gbase[1] = fcrd_eq.gb; - SS_ref_db.gbase[2] = hcrd_eq.gb; - - SS_ref_db.ElShearMod[0] = crd_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fcrd_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = hcrd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = crd_eq.C[i]; - SS_ref_db.Comp[1][i] = fcrd_eq.C[i]; - SS_ref_db.Comp[2][i] = hcrd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - - return SS_ref_db; -}
    - - -/**************************************************************************************/ -/**************************************************************************************/ -/*********************IGNEOUS DRY DATABASE (Green et al., 2023)************************/ -/**************************************************************************************/ -/**************************************************************************************/ - -
    [docs]/** - retrieve reference thermodynamic data for igd_liq -*/ -SS_ref G_SS_igd_liq_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"q3L","sl1L","wo1L","fo2L","fa2L","neL","hmL","ekL","tiL","kjL","anL","ab1L","enL","kfL","wat1L"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 10.1 - 0.1*SS_ref_db.P; - SS_ref_db.W[1] = 12.90; - SS_ref_db.W[2] = 44.7 - 0.56*SS_ref_db.P; - SS_ref_db.W[3] = 3.9 - 0.61*SS_ref_db.P; - SS_ref_db.W[4] = 12.00; - SS_ref_db.W[5] = 20.00; - SS_ref_db.W[6] = -0.02*SS_ref_db.P - 4.3; - SS_ref_db.W[7] = 31.40; - SS_ref_db.W[8] = 0.07*SS_ref_db.P + 0.8; - SS_ref_db.W[9] = 0.02*SS_ref_db.P - 16.4; - SS_ref_db.W[10] = 0.8000; - SS_ref_db.W[11] = 33.6 - 0.48*SS_ref_db.P; - SS_ref_db.W[12] = -0.44*SS_ref_db.P - 3.8; - SS_ref_db.W[13] = 16.0 - 1.4*SS_ref_db.P; - SS_ref_db.W[14] = 0.8*SS_ref_db.P - 28.0; - SS_ref_db.W[15] = 7.6 - 0.12*SS_ref_db.P; - SS_ref_db.W[16] = 3.100; - SS_ref_db.W[17] = 18.10; - SS_ref_db.W[18] = -5.000; - SS_ref_db.W[19] = -3.100; - SS_ref_db.W[20] = 14.1 - 0.03*SS_ref_db.P; - SS_ref_db.W[21] = 0.02*SS_ref_db.P + 6.5; - SS_ref_db.W[22] = 5.100; - SS_ref_db.W[23] = 0.3000; - SS_ref_db.W[24] = 0.06*SS_ref_db.P + 1.0; - SS_ref_db.W[25] = 4.400; - SS_ref_db.W[26] = 23.5 - 1.04*SS_ref_db.P; - SS_ref_db.W[27] = 0.11*SS_ref_db.P + 35.7; - SS_ref_db.W[28] = 25.70; - SS_ref_db.W[29] = -0.02*SS_ref_db.P - 2.4; - SS_ref_db.W[30] = 0.0; - SS_ref_db.W[31] = -10.20; - SS_ref_db.W[32] = 0.03*SS_ref_db.P + 7.5; - SS_ref_db.W[33] = 0.03*SS_ref_db.P + 0.2; - SS_ref_db.W[34] = 10.50; - SS_ref_db.W[35] = 3.700; - SS_ref_db.W[36] = 0.1*SS_ref_db.P + 14.6; - SS_ref_db.W[37] = 9.900; - SS_ref_db.W[38] = 38.5 - 0.7*SS_ref_db.P; - SS_ref_db.W[39] = 17.9 - 0.21*SS_ref_db.P; - SS_ref_db.W[40] = 0.02*SS_ref_db.P - 0.2; - SS_ref_db.W[41] = 0.0; - SS_ref_db.W[42] = -3.100; - SS_ref_db.W[43] = 2.3 - 0.16*SS_ref_db.P; - SS_ref_db.W[44] = 2.800; - SS_ref_db.W[45] = -0.02*SS_ref_db.P - 5.4; - SS_ref_db.W[46] = 1.900; - SS_ref_db.W[47] = 0.26*SS_ref_db.P + 0.8; - SS_ref_db.W[48] = -6.400; - SS_ref_db.W[49] = 4.6 - 1.77*SS_ref_db.P; - SS_ref_db.W[50] = 7.7 - 0.05*SS_ref_db.P; - SS_ref_db.W[51] = -30.00; - SS_ref_db.W[52] = 0.0; - SS_ref_db.W[53] = 0.02*SS_ref_db.P - 9.6; - SS_ref_db.W[54] = 8.900; - SS_ref_db.W[55] = -6.500; - SS_ref_db.W[56] = 0.6000; - SS_ref_db.W[57] = 2.900; - SS_ref_db.W[58] = -6.500; - SS_ref_db.W[59] = 3.7 - 1.87*SS_ref_db.P; - SS_ref_db.W[60] = 10.00; - SS_ref_db.W[61] = 0.0; - SS_ref_db.W[62] = 0.14*SS_ref_db.P + 10.3; - SS_ref_db.W[63] = -5.900; - SS_ref_db.W[64] = 7.200; - SS_ref_db.W[65] = 0.12*SS_ref_db.P - 0.5; - SS_ref_db.W[66] = 2.300; - SS_ref_db.W[67] = 0.09*SS_ref_db.P - 1.5; - SS_ref_db.W[68] = 1.87*SS_ref_db.P - 71.2; - SS_ref_db.W[69] = 0.0; - SS_ref_db.W[70] = -2.800; - SS_ref_db.W[71] = 10.00; - SS_ref_db.W[72] = 0.0; - SS_ref_db.W[73] = 0.0; - SS_ref_db.W[74] = 0.0; - SS_ref_db.W[75] = 0.0; - SS_ref_db.W[76] = 57.9 - 0.66*SS_ref_db.P; - SS_ref_db.W[77] = -2.000; - SS_ref_db.W[78] = 0.0; - SS_ref_db.W[79] = 0.0; - SS_ref_db.W[80] = 0.5000; - SS_ref_db.W[81] = 0.0; - SS_ref_db.W[82] = 0.0; - SS_ref_db.W[83] = 30.0 - 0.66*SS_ref_db.P; - SS_ref_db.W[84] = 2.800; - SS_ref_db.W[85] = -4.500; - SS_ref_db.W[86] = -2.300; - SS_ref_db.W[87] = 17.40; - SS_ref_db.W[88] = -8.100; - SS_ref_db.W[89] = 28.8 - 0.6*SS_ref_db.P; - SS_ref_db.W[90] = -5.600; - SS_ref_db.W[91] = -2.900; - SS_ref_db.W[92] = -2.000; - SS_ref_db.W[93] = 0.32*SS_ref_db.P + 15.3; - SS_ref_db.W[94] = 2.47*SS_ref_db.P - 52.3; - SS_ref_db.W[95] = 0.2000; - SS_ref_db.W[96] = 0.0; - SS_ref_db.W[97] = 0.0; - SS_ref_db.W[98] = 1.68*SS_ref_db.P - 12.7; - SS_ref_db.W[99] = 0.0; - SS_ref_db.W[100] = 10.00; - SS_ref_db.W[101] = -0.82*SS_ref_db.P - 20.2; - SS_ref_db.W[102] = 0.0; - SS_ref_db.W[103] = -0.15*SS_ref_db.P - 12.2; - SS_ref_db.W[104] = 2.0 - 0.54*SS_ref_db.P; - - SS_ref_db.v[0] = 100.0; - SS_ref_db.v[1] = 145.0; - SS_ref_db.v[2] = 145.0; - SS_ref_db.v[3] = 200.0; - SS_ref_db.v[4] = 100.0; - SS_ref_db.v[5] = 100.0; - SS_ref_db.v[6] = 100.0; - SS_ref_db.v[7] = 100.0; - SS_ref_db.v[8] = 100.0; - SS_ref_db.v[9] = 100.0; - SS_ref_db.v[10] = 100.0; - SS_ref_db.v[11] = 100.0; - SS_ref_db.v[12] = 100.0; - SS_ref_db.v[13] = 100.0; - SS_ref_db.v[14] = 82.00; - - - em_data qL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "qL", - "equilibrium" ); - - em_data silL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "silL", - "equilibrium" ); - - em_data woL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "woL", - "equilibrium" ); - - em_data foL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "foL", - "equilibrium" ); - - em_data faL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "faL", - "equilibrium" ); - - em_data abL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "abL", - "equilibrium" ); - - em_data hemL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hemL", - "equilibrium" ); - - em_data eskL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "eskL", - "equilibrium" ); - - em_data ruL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ruL", - "equilibrium" ); - - em_data kspL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kspL", - "equilibrium" ); - - em_data watL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "h2oL", - "equilibrium" ); - - SS_ref_db.gbase[0] = -0.097*z_b.P + 3.*qL_eq.gb + 0.1; - SS_ref_db.gbase[1] = -0.339*z_b.P + silL_eq.gb + 6.81; - SS_ref_db.gbase[2] = -0.108*z_b.P + woL_eq.gb - 1.6; - SS_ref_db.gbase[3] = -0.171*z_b.P + 2.*foL_eq.gb + 14.43; - SS_ref_db.gbase[4] = -0.052*z_b.P + 2.*faL_eq.gb + 16.8; - SS_ref_db.gbase[5] = 0.336*z_b.P + abL_eq.gb - 2.*qL_eq.gb + 33.54; - SS_ref_db.gbase[6] = -0.023*z_b.P + hemL_eq.gb/2. + 3.09; - SS_ref_db.gbase[7] = 0.162*z_b.P + eskL_eq.gb/2. + 24.47; - SS_ref_db.gbase[8] = -0.256*z_b.P + ruL_eq.gb - 1.08; - SS_ref_db.gbase[9] = 0.297*z_b.P + kspL_eq.gb - qL_eq.gb + 21.26; - SS_ref_db.gbase[10] = 0.065*z_b.P + 0.055*z_b.T + silL_eq.gb + woL_eq.gb - 103.21; - SS_ref_db.gbase[11] = -0.091*z_b.P + abL_eq.gb + 5.69; - SS_ref_db.gbase[12] = -0.577*z_b.P + foL_eq.gb + qL_eq.gb - 9.87; - SS_ref_db.gbase[13] = -0.075*z_b.P + kspL_eq.gb + 4.96; - SS_ref_db.gbase[14] = 0.002*z_b.P - 0.0039*z_b.T + watL_eq.gb + 11.16; - - SS_ref_db.ElShearMod[0] = 3.*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = silL_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = woL_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = 2.*foL_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = 2.*faL_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = abL_eq.ElShearMod - 2.*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = hemL_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[7] = eskL_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[8] = ruL_eq.ElShearMod; - SS_ref_db.ElShearMod[9] = kspL_eq.ElShearMod - qL_eq.ElShearMod; - SS_ref_db.ElShearMod[10] = silL_eq.ElShearMod + woL_eq.ElShearMod; - SS_ref_db.ElShearMod[11] = abL_eq.ElShearMod; - SS_ref_db.ElShearMod[12] = foL_eq.ElShearMod + qL_eq.ElShearMod; - SS_ref_db.ElShearMod[13] = kspL_eq.ElShearMod; - SS_ref_db.ElShearMod[14] = watL_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = 3.*qL_eq.C[i]; - SS_ref_db.Comp[1][i] = silL_eq.C[i]; - SS_ref_db.Comp[2][i] = woL_eq.C[i]; - SS_ref_db.Comp[3][i] = 2.*foL_eq.C[i]; - SS_ref_db.Comp[4][i] = 2.*faL_eq.C[i]; - SS_ref_db.Comp[5][i] = abL_eq.C[i] - 2.*qL_eq.C[i]; - SS_ref_db.Comp[6][i] = hemL_eq.C[i]/2.; - SS_ref_db.Comp[7][i] = eskL_eq.C[i]/2.; - SS_ref_db.Comp[8][i] = ruL_eq.C[i]; - SS_ref_db.Comp[9][i] = kspL_eq.C[i] - qL_eq.C[i]; - SS_ref_db.Comp[10][i] = silL_eq.C[i] + woL_eq.C[i]; - SS_ref_db.Comp[11][i] = abL_eq.C[i]; - SS_ref_db.Comp[12][i] = foL_eq.C[i] + qL_eq.C[i]; - SS_ref_db.Comp[13][i] = kspL_eq.C[i]; - SS_ref_db.Comp[14][i] = watL_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = 0.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - SS_ref_db.bounds_ref[9][0] = 0.0+eps; SS_ref_db.bounds_ref[9][1] = 1.0-eps; - SS_ref_db.bounds_ref[10][0] = 0.0+eps; SS_ref_db.bounds_ref[10][1] = 1.0-eps; - SS_ref_db.bounds_ref[11][0] = 0.0+eps; SS_ref_db.bounds_ref[11][1] = 1.0-eps; - SS_ref_db.bounds_ref[12][0] = 0.0+eps; SS_ref_db.bounds_ref[12][1] = 1.0-eps; - SS_ref_db.bounds_ref[13][0] = 0.0+eps; SS_ref_db.bounds_ref[13][1] = 1.0-eps; - - if (z_b.bulk_rock[10] == 0.){ - SS_ref_db.z_em[14] = 0.0; - SS_ref_db.bounds_ref[9][0] = eps; - SS_ref_db.bounds_ref[9][1] = eps; - } - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[7] = 0.0; - SS_ref_db.d_em[7] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[6] = 0.0; - SS_ref_db.d_em[6] = 1.0; - SS_ref_db.bounds_ref[5][0] = 0.0; - SS_ref_db.bounds_ref[5][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_fl -*/ -SS_ref G_SS_igd_fl_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"qfL","nefL","ksfL","H2O"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.04*SS_ref_db.P + 2.2; - SS_ref_db.W[1] = 0.3 - 0.03*SS_ref_db.P; - SS_ref_db.W[2] = 72.8 - 1.03*SS_ref_db.P; - SS_ref_db.W[3] = 0.0; - SS_ref_db.W[4] = 69.6 - 0.8*SS_ref_db.P; - SS_ref_db.W[5] = 75.1 - 1.35*SS_ref_db.P; - - - em_data qL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "qL", - "equilibrium" ); - - em_data abL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "abL", - "equilibrium" ); - - em_data kspL_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kspL", - "equilibrium" ); - - em_data H2O_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "H2O", - "equilibrium" ); - - SS_ref_db.gbase[0] = -0.434*z_b.P + 3.*qL_eq.gb + 11.04; - SS_ref_db.gbase[1] = -0.77*z_b.P + abL_eq.gb - 2.*qL_eq.gb + 59.9; - SS_ref_db.gbase[2] = -0.98*z_b.P + kspL_eq.gb - 2.*qL_eq.gb + 54.81; - SS_ref_db.gbase[3] = H2O_eq.gb; - - SS_ref_db.ElShearMod[0] = 3.*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = abL_eq.ElShearMod - 2.*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = kspL_eq.ElShearMod - 2.*qL_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = H2O_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = 3.*qL_eq.C[i]; - SS_ref_db.Comp[1][i] = abL_eq.C[i] - 2.*qL_eq.C[i]; - SS_ref_db.Comp[2][i] = kspL_eq.C[i] - 2.*qL_eq.C[i]; - SS_ref_db.Comp[3][i] = H2O_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_fsp -*/ -SS_ref G_SS_igd_fsp_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"ab","an","san"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = -0.04*SS_ref_db.P - 0.00935*SS_ref_db.T + 14.6; - SS_ref_db.W[1] = 0.338*SS_ref_db.P - 0.00957*SS_ref_db.T + 24.1; - SS_ref_db.W[2] = 48.5 - 0.13*SS_ref_db.P; - - SS_ref_db.v[0] = 0.6740; - SS_ref_db.v[1] = 0.5500; - SS_ref_db.v[2] = 1.000; - - - em_data ab_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ab", - "equilibrium" ); - - em_data an_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "an", - "equilibrium" ); - - em_data san_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "san", - "equilibrium" ); - - SS_ref_db.gbase[0] = ab_eq.gb; - SS_ref_db.gbase[1] = an_eq.gb; - SS_ref_db.gbase[2] = san_eq.gb; - - SS_ref_db.ElShearMod[0] = ab_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = an_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = san_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ab_eq.C[i]; - SS_ref_db.Comp[1][i] = an_eq.C[i]; - SS_ref_db.Comp[2][i] = san_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_spn -*/ -SS_ref G_SS_igd_spn_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"nsp","isp","nhc","ihc","nmt","imt","pcr","usp"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = -6.700; - SS_ref_db.W[1] = 3.600; - SS_ref_db.W[2] = -9.800; - SS_ref_db.W[3] = 43.20; - SS_ref_db.W[4] = 49.50; - SS_ref_db.W[5] = -0.08*SS_ref_db.P - 38.4; - SS_ref_db.W[6] = 40.00; - SS_ref_db.W[7] = 2.700; - SS_ref_db.W[8] = -3.500; - SS_ref_db.W[9] = 36.80; - SS_ref_db.W[10] = 20.70; - SS_ref_db.W[11] = -0.08*SS_ref_db.P - 21.6; - SS_ref_db.W[12] = 38.20; - SS_ref_db.W[13] = -6.000; - SS_ref_db.W[14] = 17.50; - SS_ref_db.W[15] = 51.60; - SS_ref_db.W[16] = -53.80; - SS_ref_db.W[17] = 25.70; - SS_ref_db.W[18] = -4.100; - SS_ref_db.W[19] = 10.00; - SS_ref_db.W[20] = -38.80; - SS_ref_db.W[21] = 21.00; - SS_ref_db.W[22] = 18.10; - SS_ref_db.W[23] = 12.10; - SS_ref_db.W[24] = 5.200; - SS_ref_db.W[25] = -8.700; - SS_ref_db.W[26] = 21.50; - SS_ref_db.W[27] = 15.00; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.000; - SS_ref_db.v[3] = 1.000; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - SS_ref_db.v[6] = 1.000; - SS_ref_db.v[7] = 0.9000; - - - em_data sp_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "sp", - "ordered" ); - - em_data herc_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "herc", - "ordered" ); - - em_data mt_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mt", - "equilibrium" ); - - em_data picr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "picr", - "equilibrium" ); - - em_data usp_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "usp", - "equilibrium" ); - - SS_ref_db.gbase[0] = sp_or.gb; - SS_ref_db.gbase[1] = -0.005763*z_b.T + sp_or.gb + 23.5; - SS_ref_db.gbase[2] = herc_or.gb; - SS_ref_db.gbase[3] = -0.005763*z_b.T + herc_or.gb + 23.6; - SS_ref_db.gbase[4] = 0.005763*z_b.T + mt_eq.gb; - SS_ref_db.gbase[5] = mt_eq.gb + 0.3; - SS_ref_db.gbase[6] = picr_eq.gb; - SS_ref_db.gbase[7] = usp_eq.gb; - - SS_ref_db.ElShearMod[0] = sp_or.ElShearMod; - SS_ref_db.ElShearMod[1] = sp_or.ElShearMod; - SS_ref_db.ElShearMod[2] = herc_or.ElShearMod; - SS_ref_db.ElShearMod[3] = herc_or.ElShearMod; - SS_ref_db.ElShearMod[4] = mt_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = mt_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = picr_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = usp_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = sp_or.C[i]; - SS_ref_db.Comp[1][i] = sp_or.C[i]; - SS_ref_db.Comp[2][i] = herc_or.C[i]; - SS_ref_db.Comp[3][i] = herc_or.C[i]; - SS_ref_db.Comp[4][i] = mt_eq.C[i]; - SS_ref_db.Comp[5][i] = mt_eq.C[i]; - SS_ref_db.Comp[6][i] = picr_eq.C[i]; - SS_ref_db.Comp[7][i] = usp_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -1.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = -1.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = -1.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[6] = 0.0; - SS_ref_db.d_em[6] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - SS_ref_db.bounds_ref[1][0] = 0.0; - SS_ref_db.bounds_ref[1][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_g -*/ -SS_ref G_SS_igd_g_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"py","alm","gr","andr","knr","tig"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.1*SS_ref_db.P + 4.0; - SS_ref_db.W[1] = 0.04*SS_ref_db.P - 0.01*SS_ref_db.T + 45.4; - SS_ref_db.W[2] = -0.036*SS_ref_db.P - 0.01*SS_ref_db.T + 107.0; - SS_ref_db.W[3] = 2.000; - SS_ref_db.W[4] = 0.0; - SS_ref_db.W[5] = 0.1*SS_ref_db.P - 0.01*SS_ref_db.T + 17.0; - SS_ref_db.W[6] = 0.039*SS_ref_db.P - 0.01*SS_ref_db.T + 65.0; - SS_ref_db.W[7] = 0.01*SS_ref_db.P + 8.2; - SS_ref_db.W[8] = 0.0; - SS_ref_db.W[9] = 2.000; - SS_ref_db.W[10] = 0.18*SS_ref_db.P - 0.01*SS_ref_db.T + 5.0; - SS_ref_db.W[11] = 0.0; - SS_ref_db.W[12] = 0.1*SS_ref_db.P - 0.01*SS_ref_db.T + 63.0; - SS_ref_db.W[13] = 0.0; - SS_ref_db.W[14] = 0.0; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 2.500; - SS_ref_db.v[3] = 2.500; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - - - em_data py_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "py", - "equilibrium" ); - - em_data alm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "alm", - "equilibrium" ); - - em_data gr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gr", - "equilibrium" ); - - em_data andr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "andr", - "equilibrium" ); - - em_data knor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "knor", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - SS_ref_db.gbase[0] = py_eq.gb; - SS_ref_db.gbase[1] = alm_eq.gb; - SS_ref_db.gbase[2] = gr_eq.gb; - SS_ref_db.gbase[3] = andr_eq.gb; - SS_ref_db.gbase[4] = knor_eq.gb; - SS_ref_db.gbase[5] = -0.0173*z_b.T - cor_eq.gb/2. + per_eq.gb/2. + py_eq.gb + ru_eq.gb/2. + 53.5; - - SS_ref_db.ElShearMod[0] = py_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = alm_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = gr_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = andr_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = knor_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -cor_eq.ElShearMod/2. + per_eq.ElShearMod/2. + py_eq.ElShearMod + ru_eq.ElShearMod/2.; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = py_eq.C[i]; - SS_ref_db.Comp[1][i] = alm_eq.C[i]; - SS_ref_db.Comp[2][i] = gr_eq.C[i]; - SS_ref_db.Comp[3][i] = andr_eq.C[i]; - SS_ref_db.Comp[4][i] = knor_eq.C[i]; - SS_ref_db.Comp[5][i] = -cor_eq.C[i]/2. + per_eq.C[i]/2. + py_eq.C[i] + ru_eq.C[i]/2.; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.bounds_ref[3][0] = 0.0; - SS_ref_db.bounds_ref[3][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[3] = 0.0; - SS_ref_db.d_em[3] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_ol -*/ -SS_ref G_SS_igd_ol_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"mnt","fa","fo","cfm"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 24.00; - SS_ref_db.W[1] = 38.00; - SS_ref_db.W[2] = 24.00; - SS_ref_db.W[3] = 9.000; - SS_ref_db.W[4] = 4.500; - SS_ref_db.W[5] = 4.500; - - - em_data mont_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mont", - "equilibrium" ); - - em_data fa_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fa", - "equilibrium" ); - - em_data fo_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fo", - "equilibrium" ); - - SS_ref_db.gbase[0] = mont_eq.gb; - SS_ref_db.gbase[1] = fa_eq.gb; - SS_ref_db.gbase[2] = fo_eq.gb; - SS_ref_db.gbase[3] = fa_eq.gb/2. + fo_eq.gb/2.; - - SS_ref_db.ElShearMod[0] = mont_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fa_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = fo_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = fa_eq.ElShearMod/2. + fo_eq.ElShearMod/2.; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = mont_eq.C[i]; - SS_ref_db.Comp[1][i] = fa_eq.C[i]; - SS_ref_db.Comp[2][i] = fo_eq.C[i]; - SS_ref_db.Comp[3][i] = fa_eq.C[i]/2. + fo_eq.C[i]/2.; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = -0.5+eps; SS_ref_db.bounds_ref[2][1] = 0.5-eps; - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_opx -*/ -SS_ref G_SS_igd_opx_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"en","fs","fm","odi","mgts","cren","obuf","mess","ojd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 7.000; - SS_ref_db.W[1] = 3.500; - SS_ref_db.W[2] = 0.15*SS_ref_db.P + 29.0; - SS_ref_db.W[3] = 12.5 - 0.04*SS_ref_db.P; - SS_ref_db.W[4] = 8.000; - SS_ref_db.W[5] = 6.000; - SS_ref_db.W[6] = 8.000; - SS_ref_db.W[7] = 35.00; - SS_ref_db.W[8] = 4.500; - SS_ref_db.W[9] = 0.08*SS_ref_db.P + 23.0; - SS_ref_db.W[10] = 11.0 - 0.15*SS_ref_db.P; - SS_ref_db.W[11] = 10.00; - SS_ref_db.W[12] = 7.000; - SS_ref_db.W[13] = 10.00; - SS_ref_db.W[14] = 35.00; - SS_ref_db.W[15] = 0.08*SS_ref_db.P + 19.0; - SS_ref_db.W[16] = 15.0 - 0.15*SS_ref_db.P; - SS_ref_db.W[17] = 12.00; - SS_ref_db.W[18] = 8.000; - SS_ref_db.W[19] = 12.00; - SS_ref_db.W[20] = 35.00; - SS_ref_db.W[21] = 75.5 - 0.84*SS_ref_db.P; - SS_ref_db.W[22] = 20.00; - SS_ref_db.W[23] = 40.00; - SS_ref_db.W[24] = 20.00; - SS_ref_db.W[25] = 35.00; - SS_ref_db.W[26] = 2.000; - SS_ref_db.W[27] = 10.00; - SS_ref_db.W[28] = 2.000; - SS_ref_db.W[29] = 7.000; - SS_ref_db.W[30] = 6.000; - SS_ref_db.W[31] = 2.000; - SS_ref_db.W[32] = -11.00; - SS_ref_db.W[33] = 6.000; - SS_ref_db.W[34] = 20.00; - SS_ref_db.W[35] = -11.00; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.000; - SS_ref_db.v[3] = 1.200; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - SS_ref_db.v[6] = 1.000; - SS_ref_db.v[7] = 1.000; - SS_ref_db.v[8] = 1.200; - - - em_data en_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "en", - "equilibrium" ); - - em_data fs_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fs", - "equilibrium" ); - - em_data di_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "di", - "equilibrium" ); - - em_data mgts_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mgts", - "equilibrium" ); - - em_data kos_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kos", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - SS_ref_db.gbase[0] = en_eq.gb; - SS_ref_db.gbase[1] = fs_eq.gb; - SS_ref_db.gbase[2] = en_eq.gb/2. + fs_eq.gb/2. - 6.6; - SS_ref_db.gbase[3] = 0.005*z_b.P + di_eq.gb + 2.8; - SS_ref_db.gbase[4] = mgts_eq.gb; - SS_ref_db.gbase[5] = 0.02*z_b.P + 0.0155*z_b.T - jd_eq.gb + kos_eq.gb + mgts_eq.gb - 28.64; - SS_ref_db.gbase[6] = 0.37*z_b.P - 0.0051*z_b.T - cor_eq.gb/2. + mgts_eq.gb + per_eq.gb/2. + ru_eq.gb/2. - 3.91; - SS_ref_db.gbase[7] = -0.089*z_b.P + acm_eq.gb - jd_eq.gb + mgts_eq.gb - 0.07; - SS_ref_db.gbase[8] = jd_eq.gb + 18.2; - - SS_ref_db.ElShearMod[0] = en_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fs_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = en_eq.ElShearMod/2. + fs_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[3] = di_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -jd_eq.ElShearMod + kos_eq.ElShearMod + mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = -cor_eq.ElShearMod/2. + mgts_eq.ElShearMod + per_eq.ElShearMod/2. + ru_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[7] = acm_eq.ElShearMod - jd_eq.ElShearMod + mgts_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = en_eq.C[i]; - SS_ref_db.Comp[1][i] = fs_eq.C[i]; - SS_ref_db.Comp[2][i] = en_eq.C[i]/2. + fs_eq.C[i]/2.; - SS_ref_db.Comp[3][i] = di_eq.C[i]; - SS_ref_db.Comp[4][i] = mgts_eq.C[i]; - SS_ref_db.Comp[5][i] = -jd_eq.C[i] + kos_eq.C[i] + mgts_eq.C[i]; - SS_ref_db.Comp[6][i] = -cor_eq.C[i]/2. + mgts_eq.C[i] + per_eq.C[i]/2. + ru_eq.C[i]/2.; - SS_ref_db.Comp[7][i] = acm_eq.C[i] - jd_eq.C[i] + mgts_eq.C[i]; - SS_ref_db.Comp[8][i] = jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 2.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = -1.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[7] = 0.0; - SS_ref_db.d_em[7] = 1.0; - SS_ref_db.bounds_ref[4][0] = 0.0; - SS_ref_db.bounds_ref[4][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_cpx -*/ -SS_ref G_SS_igd_cpx_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"di","cfs","cats","crdi","cess","cbuf","jd","cen","cfm","kjd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 25.8 - 0.03*SS_ref_db.P; - SS_ref_db.W[1] = 13.0 - 0.06*SS_ref_db.P; - SS_ref_db.W[2] = 8.000; - SS_ref_db.W[3] = 8.000; - SS_ref_db.W[4] = 8.000; - SS_ref_db.W[5] = 26.00; - SS_ref_db.W[6] = 29.8 - 0.03*SS_ref_db.P; - SS_ref_db.W[7] = 20.6 - 0.03*SS_ref_db.P; - SS_ref_db.W[8] = 26.00; - SS_ref_db.W[9] = 25.0 - 0.1*SS_ref_db.P; - SS_ref_db.W[10] = 38.30; - SS_ref_db.W[11] = 43.30; - SS_ref_db.W[12] = 24.00; - SS_ref_db.W[13] = 24.00; - SS_ref_db.W[14] = 2.300; - SS_ref_db.W[15] = 3.500; - SS_ref_db.W[16] = 24.00; - SS_ref_db.W[17] = 2.000; - SS_ref_db.W[18] = 2.000; - SS_ref_db.W[19] = 6.000; - SS_ref_db.W[20] = 6.000; - SS_ref_db.W[21] = 45.2 - 0.35*SS_ref_db.P; - SS_ref_db.W[22] = 27.0 - 0.1*SS_ref_db.P; - SS_ref_db.W[23] = 6.000; - SS_ref_db.W[24] = 2.000; - SS_ref_db.W[25] = 6.000; - SS_ref_db.W[26] = 3.000; - SS_ref_db.W[27] = 52.30; - SS_ref_db.W[28] = 40.30; - SS_ref_db.W[29] = 3.000; - SS_ref_db.W[30] = 6.000; - SS_ref_db.W[31] = 3.000; - SS_ref_db.W[32] = 57.30; - SS_ref_db.W[33] = 45.30; - SS_ref_db.W[34] = 3.000; - SS_ref_db.W[35] = 16.00; - SS_ref_db.W[36] = 24.00; - SS_ref_db.W[37] = 22.00; - SS_ref_db.W[38] = 16.00; - SS_ref_db.W[39] = 40.00; - SS_ref_db.W[40] = 26.00; - SS_ref_db.W[41] = 28.00; - SS_ref_db.W[42] = 4.000; - SS_ref_db.W[43] = 40.00; - SS_ref_db.W[44] = 40.00; - - SS_ref_db.v[0] = 1.200; - SS_ref_db.v[1] = 1.000; - SS_ref_db.v[2] = 1.900; - SS_ref_db.v[3] = 1.900; - SS_ref_db.v[4] = 1.900; - SS_ref_db.v[5] = 1.900; - SS_ref_db.v[6] = 1.200; - SS_ref_db.v[7] = 1.000; - SS_ref_db.v[8] = 1.000; - SS_ref_db.v[9] = 1.200; - - - em_data di_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "di", - "equilibrium" ); - - em_data fs_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fs", - "equilibrium" ); - - em_data cats_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cats", - "equilibrium" ); - - em_data kos_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "kos", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data cor_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cor", - "equilibrium" ); - - em_data per_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "per", - "equilibrium" ); - - em_data en_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "en", - "equilibrium" ); - - em_data san_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "san", - "equilibrium" ); - - em_data abh_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "abh", - "equilibrium" ); - - SS_ref_db.gbase[0] = di_eq.gb; - SS_ref_db.gbase[1] = 0.045*z_b.P - 0.002*z_b.T + fs_eq.gb + 2.1; - SS_ref_db.gbase[2] = cats_eq.gb; - SS_ref_db.gbase[3] = cats_eq.gb - jd_eq.gb + kos_eq.gb + 4.85; - SS_ref_db.gbase[4] = acm_eq.gb + cats_eq.gb - jd_eq.gb - 3.46; - SS_ref_db.gbase[5] = 0.248*z_b.P - 0.0012*z_b.T - cor_eq.gb/2. + cats_eq.gb + per_eq.gb/2. + ru_eq.gb/2. - 20.89; - SS_ref_db.gbase[6] = jd_eq.gb; - SS_ref_db.gbase[7] = 0.048*z_b.P - 0.002*z_b.T + en_eq.gb + 3.5; - SS_ref_db.gbase[8] = 0.0465*z_b.P - 0.002*z_b.T + en_eq.gb/2. + fs_eq.gb/2. - 1.6; - SS_ref_db.gbase[9] = 0.6*z_b.P - abh_eq.gb + san_eq.gb + jd_eq.gb + 10.82; - - SS_ref_db.ElShearMod[0] = di_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fs_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = cats_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = cats_eq.ElShearMod - jd_eq.ElShearMod + kos_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = acm_eq.ElShearMod + cats_eq.ElShearMod - jd_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = -cor_eq.ElShearMod/2. + cats_eq.ElShearMod + per_eq.ElShearMod/2. + ru_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[6] = jd_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = en_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = en_eq.ElShearMod/2. + fs_eq.ElShearMod/2.; - SS_ref_db.ElShearMod[9] = -abh_eq.ElShearMod + san_eq.ElShearMod + jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = di_eq.C[i]; - SS_ref_db.Comp[1][i] = fs_eq.C[i]; - SS_ref_db.Comp[2][i] = cats_eq.C[i]; - SS_ref_db.Comp[3][i] = cats_eq.C[i] - jd_eq.C[i] + kos_eq.C[i]; - SS_ref_db.Comp[4][i] = acm_eq.C[i] + cats_eq.C[i] - jd_eq.C[i]; - SS_ref_db.Comp[5][i] = -cor_eq.C[i]/2. + cats_eq.C[i] + per_eq.C[i]/2. + ru_eq.C[i]/2.; - SS_ref_db.Comp[6][i] = jd_eq.C[i]; - SS_ref_db.Comp[7][i] = en_eq.C[i]; - SS_ref_db.Comp[8][i] = en_eq.C[i]/2. + fs_eq.C[i]/2.; - SS_ref_db.Comp[9][i] = -abh_eq.C[i] + san_eq.C[i] + jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 2.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -1.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = 0.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - - if (z_b.bulk_rock[9] == 0.){ - SS_ref_db.z_em[3] = 0.0; - SS_ref_db.d_em[3] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[4] = 0.0; - SS_ref_db.d_em[4] = 1.0; - SS_ref_db.bounds_ref[5][0] = 0.0; - SS_ref_db.bounds_ref[5][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_ilm -*/ -SS_ref G_SS_igd_ilm_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"oilm","dilm","hm","ogk","dgk"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.13*SS_ref_db.P + 7.05; - SS_ref_db.W[1] = 14.30; - SS_ref_db.W[2] = -7.600; - SS_ref_db.W[3] = 0.6000; - SS_ref_db.W[4] = 7.25 - 0.13*SS_ref_db.P; - SS_ref_db.W[5] = -5.500; - SS_ref_db.W[6] = -2.200; - SS_ref_db.W[7] = 12.50; - SS_ref_db.W[8] = 2.700; - SS_ref_db.W[9] = 8.300; - - - em_data ilm_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ilm", - "ordered" ); - - em_data ilm_di = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ilm", - "disordered" ); - - em_data hem_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hem", - "equilibrium" ); - - em_data geik_or = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "geik", - "ordered" ); - - em_data geik_di = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "geik", - "disordered" ); - - SS_ref_db.gbase[0] = ilm_or.gb; - SS_ref_db.gbase[1] = ilm_di.gb; - SS_ref_db.gbase[2] = hem_eq.gb; - SS_ref_db.gbase[3] = geik_or.gb; - SS_ref_db.gbase[4] = geik_di.gb; - - SS_ref_db.ElShearMod[0] = ilm_or.ElShearMod; - SS_ref_db.ElShearMod[1] = ilm_di.ElShearMod; - SS_ref_db.ElShearMod[2] = hem_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = geik_or.ElShearMod; - SS_ref_db.ElShearMod[4] = geik_di.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = ilm_or.C[i]; - SS_ref_db.Comp[1][i] = ilm_di.C[i]; - SS_ref_db.Comp[2][i] = hem_eq.C[i]; - SS_ref_db.Comp[3][i] = geik_or.C[i]; - SS_ref_db.Comp[4][i] = geik_di.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = -1.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = -1.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[2] = 0.0; - SS_ref_db.d_em[2] = 1.0; - SS_ref_db.bounds_ref[0][0] = 1.0; - SS_ref_db.bounds_ref[0][1] = 1.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_hb -*/ -SS_ref G_SS_igd_hb_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"tr","tsm","prgm","glm","cumm","grnm","a","b","mrb","kprg","tts"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 20.00; - SS_ref_db.W[1] = 25.00; - SS_ref_db.W[2] = 65.00; - SS_ref_db.W[3] = 45.00; - SS_ref_db.W[4] = 75.00; - SS_ref_db.W[5] = 57.00; - SS_ref_db.W[6] = 63.00; - SS_ref_db.W[7] = 52.00; - SS_ref_db.W[8] = 30.00; - SS_ref_db.W[9] = 85.00; - SS_ref_db.W[10] = -40.00; - SS_ref_db.W[11] = 25.00; - SS_ref_db.W[12] = 70.00; - SS_ref_db.W[13] = 80.00; - SS_ref_db.W[14] = 70.00; - SS_ref_db.W[15] = 72.50; - SS_ref_db.W[16] = 20.00; - SS_ref_db.W[17] = -40.00; - SS_ref_db.W[18] = 35.00; - SS_ref_db.W[19] = 50.00; - SS_ref_db.W[20] = 90.00; - SS_ref_db.W[21] = 106.70; - SS_ref_db.W[22] = 94.80; - SS_ref_db.W[23] = 94.80; - SS_ref_db.W[24] = 40.00; - SS_ref_db.W[25] = 8.000; - SS_ref_db.W[26] = 15.00; - SS_ref_db.W[27] = 100.0; - SS_ref_db.W[28] = 113.50; - SS_ref_db.W[29] = 100.0; - SS_ref_db.W[30] = 111.20; - SS_ref_db.W[31] = 0.0; - SS_ref_db.W[32] = 54.00; - SS_ref_db.W[33] = 75.00; - SS_ref_db.W[34] = 33.00; - SS_ref_db.W[35] = 18.00; - SS_ref_db.W[36] = 23.00; - SS_ref_db.W[37] = 80.00; - SS_ref_db.W[38] = 87.00; - SS_ref_db.W[39] = 100.0; - SS_ref_db.W[40] = 12.00; - SS_ref_db.W[41] = 8.000; - SS_ref_db.W[42] = 91.00; - SS_ref_db.W[43] = 96.00; - SS_ref_db.W[44] = 65.00; - SS_ref_db.W[45] = 20.00; - SS_ref_db.W[46] = 80.00; - SS_ref_db.W[47] = 94.00; - SS_ref_db.W[48] = 95.00; - SS_ref_db.W[49] = 90.00; - SS_ref_db.W[50] = 94.00; - SS_ref_db.W[51] = 95.00; - SS_ref_db.W[52] = 50.00; - SS_ref_db.W[53] = 50.00; - SS_ref_db.W[54] = 35.00; - - SS_ref_db.v[0] = 1.000; - SS_ref_db.v[1] = 1.500; - SS_ref_db.v[2] = 1.700; - SS_ref_db.v[3] = 0.8000; - SS_ref_db.v[4] = 1.000; - SS_ref_db.v[5] = 1.000; - SS_ref_db.v[6] = 1.000; - SS_ref_db.v[7] = 1.000; - SS_ref_db.v[8] = 0.8000; - SS_ref_db.v[9] = 1.700; - SS_ref_db.v[10] = 1.500; - - - - em_data tr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "tr", - "equilibrium" ); - - em_data ts_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ts", - "equilibrium" ); - - em_data parg_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "parg", - "equilibrium" ); - - em_data gl_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gl", - "equilibrium" ); - - em_data cumm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cumm", - "equilibrium" ); - - em_data grun_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "grun", - "equilibrium" ); - - em_data gr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gr", - "equilibrium" ); - - em_data andr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "andr", - "equilibrium" ); - - em_data pa_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "pa", - "equilibrium" ); - - em_data mu_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mu", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data dsp_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "dsp", - "equilibrium" ); - - SS_ref_db.gbase[0] = tr_eq.gb; - SS_ref_db.gbase[1] = ts_eq.gb + 10.0; - SS_ref_db.gbase[2] = parg_eq.gb - 10.0; - SS_ref_db.gbase[3] = gl_eq.gb - 3.0; - SS_ref_db.gbase[4] = cumm_eq.gb; - SS_ref_db.gbase[5] = grun_eq.gb - 3.0; - SS_ref_db.gbase[6] = 3.0/7.0*cumm_eq.gb + 4.0/7.0*grun_eq.gb - 11.2; - SS_ref_db.gbase[7] = 2.0/7.0*cumm_eq.gb + 5.0/7.0*grun_eq.gb - 13.8; - SS_ref_db.gbase[8] = andr_eq.gb + gl_eq.gb - gr_eq.gb; - SS_ref_db.gbase[9] = 0.02*SS_ref_db.T + mu_eq.gb - pa_eq.gb + parg_eq.gb - 7.06; - SS_ref_db.gbase[10] = -2.0*dsp_eq.gb + 2.0*ru_eq.gb + ts_eq.gb + 95.0; - - SS_ref_db.ElShearMod[0] = tr_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ts_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = parg_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = gl_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = cumm_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = grun_eq.ElShearMod; - SS_ref_db.ElShearMod[6] = 3.0/7.0*cumm_eq.ElShearMod + 4.0/7.0*grun_eq.ElShearMod; - SS_ref_db.ElShearMod[7] = 2.0/7.0*cumm_eq.ElShearMod + 5.0/7.0*grun_eq.ElShearMod; - SS_ref_db.ElShearMod[8] = andr_eq.ElShearMod + gl_eq.ElShearMod - gr_eq.ElShearMod; - SS_ref_db.ElShearMod[9] = mu_eq.ElShearMod - pa_eq.ElShearMod + parg_eq.ElShearMod; - SS_ref_db.ElShearMod[10] = -2.0*dsp_eq.ElShearMod + 2.0*ru_eq.ElShearMod + ts_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = tr_eq.C[i]; - SS_ref_db.Comp[1][i] = ts_eq.C[i]; - SS_ref_db.Comp[2][i] = parg_eq.C[i]; - SS_ref_db.Comp[3][i] = gl_eq.C[i]; - SS_ref_db.Comp[4][i] = cumm_eq.C[i]; - SS_ref_db.Comp[5][i] = grun_eq.C[i]; - SS_ref_db.Comp[6][i] = 3.0/7.0*cumm_eq.C[i] + 4.0/7.0*grun_eq.C[i]; - SS_ref_db.Comp[7][i] = 2.0/7.0*cumm_eq.C[i] + 5.0/7.0*grun_eq.C[i]; - SS_ref_db.Comp[8][i] = andr_eq.C[i] + gl_eq.C[i] - gr_eq.C[i]; - SS_ref_db.Comp[9][i] = mu_eq.C[i] - pa_eq.C[i] + parg_eq.C[i]; - SS_ref_db.Comp[10][i] = -2.0*dsp_eq.C[i] + 2.0*ru_eq.C[i] + ts_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - SS_ref_db.bounds_ref[5][0] = 0.0+eps; SS_ref_db.bounds_ref[5][1] = 1.0-eps; - SS_ref_db.bounds_ref[6][0] = 0.0+eps; SS_ref_db.bounds_ref[6][1] = 1.0-eps; - SS_ref_db.bounds_ref[7][0] = 0.0+eps; SS_ref_db.bounds_ref[7][1] = 1.0-eps; - SS_ref_db.bounds_ref[8][0] = -1.0+eps; SS_ref_db.bounds_ref[8][1] = 1.0-eps; - SS_ref_db.bounds_ref[9][0] = -1.0+eps; SS_ref_db.bounds_ref[9][1] = 1.0-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[8] = 0.0; - SS_ref_db.d_em[8] = 1.0; - SS_ref_db.bounds_ref[6][0] = 0.0; - SS_ref_db.bounds_ref[6][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_bi -*/ -SS_ref G_SS_igd_bi_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"phl","annm","obi","eas","tbi","fbi"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 12.00; - SS_ref_db.W[1] = 4.000; - SS_ref_db.W[2] = 10.00; - SS_ref_db.W[3] = 30.00; - SS_ref_db.W[4] = 14.00; - SS_ref_db.W[5] = 8.000; - SS_ref_db.W[6] = 0.0; - SS_ref_db.W[7] = 32.00; - SS_ref_db.W[8] = 4.000; - SS_ref_db.W[9] = 7.000; - SS_ref_db.W[10] = 24.00; - SS_ref_db.W[11] = 7.000; - SS_ref_db.W[12] = 40.00; - SS_ref_db.W[13] = 1.000; - SS_ref_db.W[14] = 40.00; - - - em_data phl_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "phl", - "equilibrium" ); - - em_data ann_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ann", - "equilibrium" ); - - em_data east_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "east", - "equilibrium" ); - - em_data br_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "br", - "equilibrium" ); - - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - - em_data acm_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "acm", - "equilibrium" ); - - em_data jd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "jd", - "equilibrium" ); - - SS_ref_db.gbase[0] = phl_eq.gb; - SS_ref_db.gbase[1] = ann_eq.gb - 3.0; - SS_ref_db.gbase[2] = 1.0/3.0*ann_eq.gb + 2.0/3.0*phl_eq.gb - 6.0; - SS_ref_db.gbase[3] = east_eq.gb + 2.2; - SS_ref_db.gbase[4] = -br_eq.gb + phl_eq.gb + ru_eq.gb + 55.0; - SS_ref_db.gbase[5] = acm_eq.gb + east_eq.gb - jd_eq.gb -7.2; - - SS_ref_db.ElShearMod[0] = phl_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ann_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = 1.0/3.0*ann_eq.ElShearMod + 2.0/3.0*phl_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = east_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = -br_eq.ElShearMod + phl_eq.ElShearMod + ru_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = acm_eq.ElShearMod + east_eq.ElShearMod - jd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = phl_eq.C[i]; - SS_ref_db.Comp[1][i] = ann_eq.C[i]; - SS_ref_db.Comp[2][i] = 1.0/3.0*ann_eq.C[i] + 2.0/3.0*phl_eq.C[i]; - SS_ref_db.Comp[3][i] = east_eq.C[i]; - SS_ref_db.Comp[4][i] = -br_eq.C[i] + phl_eq.C[i] + ru_eq.C[i]; - SS_ref_db.Comp[5][i] = acm_eq.C[i] + east_eq.C[i] - jd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = -0.75+eps; SS_ref_db.bounds_ref[4][1] = 0.75-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.d_em[5] = 1.0; - SS_ref_db.bounds_ref[2][0] = 0.0; - SS_ref_db.bounds_ref[2][1] = 0.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_ep -*/ -SS_ref G_SS_igd_ep_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"cz","ep","fep"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 1.000; - SS_ref_db.W[1] = 3.000; - SS_ref_db.W[2] = 1.000; - - - em_data cz_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cz", - "equilibrium" ); - - em_data ep_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ep", - "equilibrium" ); - - em_data fep_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fep", - "equilibrium" ); - - SS_ref_db.gbase[0] = cz_eq.gb; - SS_ref_db.gbase[1] = ep_eq.gb; - SS_ref_db.gbase[2] = fep_eq.gb; - - SS_ref_db.ElShearMod[0] = cz_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ep_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = fep_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = cz_eq.C[i]; - SS_ref_db.Comp[1][i] = ep_eq.C[i]; - SS_ref_db.Comp[2][i] = fep_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = -0.5+eps; SS_ref_db.bounds_ref[1][1] = 0.5-eps; - - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.bounds_ref[0][0] = 0.0; - SS_ref_db.bounds_ref[0][1] = 0.0; - SS_ref_db.bounds_ref[1][0] = 0.0; - SS_ref_db.bounds_ref[1][1] = 0.0; - SS_ref_db.z_em[1] = 0.0; - SS_ref_db.d_em[1] = 1.0; - SS_ref_db.z_em[2] = 0.0; - SS_ref_db.d_em[2] = 1.0; - } - - return SS_ref_db; -}
    - -
    [docs]/** - retrieve reference thermodynamic data for igd_cd -*/ -SS_ref G_SS_igd_cd_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"crd","fcrd","hcrd"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 2.500; - SS_ref_db.W[1] = 0.0; - - - em_data crd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "crd", - "equilibrium" ); - - em_data fcrd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fcrd", - "equilibrium" ); - - em_data hcrd_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "hcrd", - "equilibrium" ); - - SS_ref_db.gbase[0] = crd_eq.gb; - SS_ref_db.gbase[1] = fcrd_eq.gb; - SS_ref_db.gbase[2] = hcrd_eq.gb; - - SS_ref_db.ElShearMod[0] = crd_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = fcrd_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = hcrd_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = crd_eq.C[i]; - SS_ref_db.Comp[1][i] = fcrd_eq.C[i]; - SS_ref_db.Comp[2][i] = hcrd_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; + data.gb = PP_db.gbase; - return SS_ref_db; + for (int i = 0; i < len_ox; i++){ + data.C[i] = PP_db.Comp[i]; + } + return data; }
    -
    [docs]/** retrieve reference thermodynamic data for mp_liq */ @@ -6255,113 +2092,48 @@

    Source code for gss_function.c

     }
    -
    [docs]/** - retrieve reference thermodynamic data for biotite + +
    [docs]/** + retrieve reference thermodynamic data for igp_fper_S11 */ -SS_ref G_SS_ig_bi_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ +SS_ref G_SS_ig_fper_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ int i, j; int n_em = SS_ref_db.n_em; - char *EM_tmp[] = {"phl","annm","obi","eas","tbi","fbi"}; + char *EM_tmp[] = {"per","wu"}; for (int i = 0; i < SS_ref_db.n_em; i++){ strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); }; - SS_ref_db.W[0] = 12.00; - SS_ref_db.W[1] = 4.000; - SS_ref_db.W[2] = 10.00; - SS_ref_db.W[3] = 30.00; - SS_ref_db.W[4] = 14.00; - SS_ref_db.W[5] = 8.000; - SS_ref_db.W[6] = 0.0; - SS_ref_db.W[7] = 32.00; - SS_ref_db.W[8] = 4.000; - SS_ref_db.W[9] = 7.000; - SS_ref_db.W[10] = 24.00; - SS_ref_db.W[11] = 7.000; - SS_ref_db.W[12] = 40.00; - SS_ref_db.W[13] = 1.000; - SS_ref_db.W[14] = 40.00; - - - em_data phl_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "phl", - "equilibrium" ); - - em_data ann_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ann", - "equilibrium" ); - - em_data east_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "east", - "equilibrium" ); - - em_data br_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "br", - "equilibrium" ); + SS_ref_db.W[0] = 13.0; - em_data ru_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ru", - "equilibrium" ); - em_data acm_eq = get_em_data( EM_database, + em_data per_eq = get_em_data( EM_database, len_ox, z_b, SS_ref_db.P, SS_ref_db.T, - "acm", + "per", "equilibrium" ); - em_data jd_eq = get_em_data( EM_database, + em_data wu_eq = get_em_data( EM_database, len_ox, z_b, SS_ref_db.P, SS_ref_db.T, - "jd", + "wu", "equilibrium" ); - SS_ref_db.gbase[0] = phl_eq.gb; - SS_ref_db.gbase[1] = ann_eq.gb - 3.0; - SS_ref_db.gbase[2] = 1.0/3.0*ann_eq.gb + 2.0/3.0*phl_eq.gb - 6.0; - SS_ref_db.gbase[3] = east_eq.gb + 2.2; - SS_ref_db.gbase[4] = -br_eq.gb + phl_eq.gb + ru_eq.gb + 55.0; - SS_ref_db.gbase[5] = acm_eq.gb + east_eq.gb - jd_eq.gb -7.2; + SS_ref_db.gbase[0] = per_eq.gb; //tentative correction to fix Stiruxe data + SS_ref_db.gbase[1] = wu_eq.gb; - SS_ref_db.ElShearMod[0] = phl_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = ann_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = 1.0/3.0*ann_eq.ElShearMod + 2.0/3.0*phl_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = east_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = -br_eq.ElShearMod + phl_eq.ElShearMod + ru_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = acm_eq.ElShearMod + east_eq.ElShearMod - jd_eq.ElShearMod; + SS_ref_db.ElShearMod[0] = per_eq.ElShearMod; + SS_ref_db.ElShearMod[1] = wu_eq.ElShearMod; for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = phl_eq.C[i]; - SS_ref_db.Comp[1][i] = ann_eq.C[i]; - SS_ref_db.Comp[2][i] = 1.0/3.0*ann_eq.C[i] + 2.0/3.0*phl_eq.C[i]; - SS_ref_db.Comp[3][i] = east_eq.C[i]; - SS_ref_db.Comp[4][i] = -br_eq.C[i] + phl_eq.C[i] + ru_eq.C[i]; - SS_ref_db.Comp[5][i] = acm_eq.C[i] + east_eq.C[i] - jd_eq.C[i]; + SS_ref_db.Comp[0][i] = per_eq.C[i]; + SS_ref_db.Comp[1][i] = wu_eq.C[i]; } for (i = 0; i < n_em; i++){ @@ -6369,10 +2141,131 @@

    Source code for gss_function.c

         };
         
         SS_ref_db.bounds_ref[0][0] = 0.0+eps;  SS_ref_db.bounds_ref[0][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[1][0] = 0.0+eps;  SS_ref_db.bounds_ref[1][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[2][0] = 0.0+eps;  SS_ref_db.bounds_ref[2][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[3][0] = 0.0+eps;  SS_ref_db.bounds_ref[3][1] = 1.0-eps;
    -	SS_ref_db.bounds_ref[4][0] = -0.75+eps;	SS_ref_db.bounds_ref[4][1] = 0.75-eps;	
    +    
    +    return SS_ref_db;
    +}
    + + +
    [docs]/** + retrieve reference thermodynamic data for biotite +*/ +SS_ref G_SS_ig_bi_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ + + char *EM_tmp[] = {"phl","annm","obi","east","tbi","fbi"}; + for (int i = 0; i < SS_ref_db.n_em; i++){ + strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); + } + + SS_ref_db.W[0] = 12.; + SS_ref_db.W[1] = 4.; + SS_ref_db.W[2] = 10.; + SS_ref_db.W[3] = 30.; + SS_ref_db.W[4] = 8.; + SS_ref_db.W[5] = 8.; + SS_ref_db.W[6] = 5.; + SS_ref_db.W[7] = 32.; + SS_ref_db.W[8] = 13.6; + SS_ref_db.W[9] = 7.; + SS_ref_db.W[10] = 24.; + SS_ref_db.W[11] = 5.6; + SS_ref_db.W[12] = 40.0; + SS_ref_db.W[13] = 1.0; + SS_ref_db.W[14] = 40.0; + + int i,j; + + int n_em = SS_ref_db.n_em; + + em_data phl_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "phl", + "equilibrium" ); + + em_data ann_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "ann", + "equilibrium" ); + + em_data east_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "east", + "equilibrium" ); + + em_data br_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "br", + "equilibrium" ); + + em_data ru_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "ru", + "equilibrium" ); + + em_data gr_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "gr", + "equilibrium" ); + + em_data andr_eq = get_em_data( EM_database, + len_ox, + z_b, + SS_ref_db.P, + SS_ref_db.T, + "andr", + "equilibrium" ); + + + SS_ref_db.gbase[0] = phl_eq.gb; + SS_ref_db.gbase[1] = ann_eq.gb - 6.0; + SS_ref_db.gbase[2] = 1./3. * ann_eq.gb + 2./3. * phl_eq.gb - 6.0; + SS_ref_db.gbase[3] = east_eq.gb; + SS_ref_db.gbase[4] = - br_eq.gb + phl_eq.gb + ru_eq.gb + 55.0; + SS_ref_db.gbase[5] = 1./2. * andr_eq.gb + east_eq.gb - 1./2. * gr_eq.gb - 3.0; + + SS_ref_db.ElShearMod[0] = phl_eq.ElShearMod; + SS_ref_db.ElShearMod[1] = ann_eq.ElShearMod; + SS_ref_db.ElShearMod[2] = 1./3. * ann_eq.ElShearMod + 2./3. * phl_eq.ElShearMod; + SS_ref_db.ElShearMod[3] = east_eq.ElShearMod; + SS_ref_db.ElShearMod[4] = - br_eq.ElShearMod + phl_eq.ElShearMod + ru_eq.ElShearMod; + SS_ref_db.ElShearMod[5] = 1./2. * andr_eq.ElShearMod + east_eq.ElShearMod - 1./2. * gr_eq.ElShearMod; + + for (i = 0; i < len_ox; i++){ + SS_ref_db.Comp[0][i] = phl_eq.C[i]; + SS_ref_db.Comp[1][i] = ann_eq.C[i]; + SS_ref_db.Comp[2][i] = 1./3. * ann_eq.C[i] + 2./3. * phl_eq.C[i] ; + SS_ref_db.Comp[3][i] = east_eq.C[i]; + SS_ref_db.Comp[4][i] = - br_eq.C[i] + phl_eq.C[i] + ru_eq.C[i] ; + SS_ref_db.Comp[5][i] = 1./2. * andr_eq.C[i] + east_eq.C[i] - 1./2. * gr_eq.C[i]; + } + + /* define endmembers to be deactivated when bulk-rock composition equal zero */ + for (i = 0; i < n_em; i++){ + SS_ref_db.z_em[i] = 1.0; + } + + SS_ref_db.bounds_ref[0][0] = 0.+eps; SS_ref_db.bounds_ref[0][1] = 1.-eps; + SS_ref_db.bounds_ref[1][0] = 0.+eps; SS_ref_db.bounds_ref[1][1] = 1.-eps; + SS_ref_db.bounds_ref[2][0] = 0.+eps; SS_ref_db.bounds_ref[2][1] = 1.-eps; + SS_ref_db.bounds_ref[3][0] = 0.+eps; SS_ref_db.bounds_ref[3][1] = 1.-eps; + SS_ref_db.bounds_ref[4][0] = 0.+eps; SS_ref_db.bounds_ref[4][1] = 1.-eps; if (z_b.bulk_rock[8] == 0.){ SS_ref_db.z_em[5] = 0.0; @@ -6397,200 +2290,207 @@

    Source code for gss_function.c

             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = 25.8 - 0.03*SS_ref_db.P;
    +    SS_ref_db.W[0] = 25.8;
         SS_ref_db.W[1] = 13.0 - 0.06*SS_ref_db.P;
    -    SS_ref_db.W[2] = 8.000;
    -    SS_ref_db.W[3] = 8.000;
    -    SS_ref_db.W[4] = 8.000;
    -    SS_ref_db.W[5] = 26.00;
    -    SS_ref_db.W[6] = 29.8 - 0.03*SS_ref_db.P;
    -    SS_ref_db.W[7] = 20.6 - 0.03*SS_ref_db.P;
    -    SS_ref_db.W[8] = 26.00;
    +    SS_ref_db.W[2] = 8.0;
    +    SS_ref_db.W[3] = 8.0;
    +    SS_ref_db.W[4] = 8.0;
    +    SS_ref_db.W[5] = 26.0;
    +    SS_ref_db.W[6] = 29.8;
    +    SS_ref_db.W[7] = 20.6;
    +    SS_ref_db.W[8] = 26.0;
         SS_ref_db.W[9] = 25.0 - 0.1*SS_ref_db.P;
    -    SS_ref_db.W[10] = 38.30;
    -    SS_ref_db.W[11] = 43.30;
    -    SS_ref_db.W[12] = 24.00;
    -    SS_ref_db.W[13] = 24.00;
    -    SS_ref_db.W[14] = 2.300;
    -    SS_ref_db.W[15] = 3.500;
    -    SS_ref_db.W[16] = 24.00;
    -    SS_ref_db.W[17] = 2.000;
    -    SS_ref_db.W[18] = 2.000;
    -    SS_ref_db.W[19] = 6.000;
    -    SS_ref_db.W[20] = 6.000;
    +    SS_ref_db.W[10] = 38.3;
    +    SS_ref_db.W[11] = 43.3;
    +    SS_ref_db.W[12] = 24.0;
    +    SS_ref_db.W[13] = 24.0;
    +    SS_ref_db.W[14] = 2.3;
    +    SS_ref_db.W[15] = 3.5;
    +    SS_ref_db.W[16] = 24.0;
    +    SS_ref_db.W[17] = 2.0;
    +    SS_ref_db.W[18] = 2.0;
    +    SS_ref_db.W[19] = 6.0;
    +    SS_ref_db.W[20] = 6.0;
         SS_ref_db.W[21] = 45.2 - 0.35*SS_ref_db.P;
         SS_ref_db.W[22] = 27.0 - 0.1*SS_ref_db.P;
    -    SS_ref_db.W[23] = 6.000;
    -    SS_ref_db.W[24] = 2.000;
    -    SS_ref_db.W[25] = 6.000;
    -    SS_ref_db.W[26] = 3.000;
    -    SS_ref_db.W[27] = 52.30;
    -    SS_ref_db.W[28] = 40.30;
    -    SS_ref_db.W[29] = 3.000;
    -    SS_ref_db.W[30] = 6.000;
    -    SS_ref_db.W[31] = 3.000;
    -    SS_ref_db.W[32] = 57.30;
    -    SS_ref_db.W[33] = 45.30;
    -    SS_ref_db.W[34] = 3.000;
    -    SS_ref_db.W[35] = 16.00;
    -    SS_ref_db.W[36] = 24.00;
    -    SS_ref_db.W[37] = 22.00;
    -    SS_ref_db.W[38] = 16.00;
    -    SS_ref_db.W[39] = 40.00;
    -    SS_ref_db.W[40] = 26.00;
    -    SS_ref_db.W[41] = 28.00;
    -    SS_ref_db.W[42] = 4.000;
    -    SS_ref_db.W[43] = 40.00;
    -    SS_ref_db.W[44] = 40.00;
    -    
    -    SS_ref_db.v[0] = 1.200;
    -    SS_ref_db.v[1] = 1.000;
    -    SS_ref_db.v[2] = 1.900;
    -    SS_ref_db.v[3] = 1.900;
    -    SS_ref_db.v[4] = 1.900;
    -    SS_ref_db.v[5] = 1.900;
    -    SS_ref_db.v[6] = 1.200;
    -    SS_ref_db.v[7] = 1.000;
    -    SS_ref_db.v[8] = 1.000;
    -    SS_ref_db.v[9] = 1.200;
    +    SS_ref_db.W[23] = 6.0;
    +    SS_ref_db.W[24] = 2.0;
    +    SS_ref_db.W[25] = 6.0;
    +    SS_ref_db.W[26] = 3.0;
    +    SS_ref_db.W[27] = 52.3;
    +    SS_ref_db.W[28] = 40.3;
    +    SS_ref_db.W[29] = 3.0;
    +    SS_ref_db.W[30] = 6.0;
    +    SS_ref_db.W[31] = 3.0;
    +    SS_ref_db.W[32] = 57.3;
    +    SS_ref_db.W[33] = 45.3;
    +    SS_ref_db.W[34] = 3.0;
    +    SS_ref_db.W[35] = 16.0;
    +    SS_ref_db.W[36] = 24.0;
    +    SS_ref_db.W[37] = 22.0;
    +    SS_ref_db.W[38] = 16.0;
    +    SS_ref_db.W[39] = 40.0;
    +    SS_ref_db.W[40] = 40.0;
    +    SS_ref_db.W[41] = 28.0;
    +    SS_ref_db.W[42] = 4.0;
    +    SS_ref_db.W[43] = 40.0;
    +    SS_ref_db.W[44] = 40.0;
    +    
    +    SS_ref_db.v[0] = 1.2;
    +    SS_ref_db.v[1] = 1.0;
    +    SS_ref_db.v[2] = 1.9;
    +    SS_ref_db.v[3] = 1.9;
    +    SS_ref_db.v[4] = 1.9;
    +    SS_ref_db.v[5] = 1.9;
    +    SS_ref_db.v[6] = 1.2;
    +    SS_ref_db.v[7] = 1.0;
    +    SS_ref_db.v[8] = 1.0;
    +    SS_ref_db.v[9] = 1.2;
         
         
         em_data di_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"di", 
         										"equilibrium"	);
         
         em_data fs_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"fs", 
         										"equilibrium"	);
         
         em_data cats_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"cats", 
         										"equilibrium"	);
         
         em_data kos_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"kos", 
         										"equilibrium"	);
         
         em_data jd_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"jd", 
         										"equilibrium"	);
         
    +    em_data cats_di 	= get_em_data(		EM_database, 
    +    										len_ox,
    +    										z_b,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"cats", 
    +    										"disordered"	);
    +    
         em_data acm_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"acm", 
         										"equilibrium"	);
         
         em_data ru_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"ru", 
         										"equilibrium"	);
         
         em_data cor_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"cor", 
         										"equilibrium"	);
         
         em_data per_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"per", 
         										"equilibrium"	);
         
         em_data en_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"en", 
         										"equilibrium"	);
         
    -    em_data san_eq 		= get_em_data(		EM_database, 
    +    em_data abh_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"san", 
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"abh", 
         										"equilibrium"	);
         
    -    em_data abh_eq 		= get_em_data(		EM_database, 
    +    em_data san_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"abh", 
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"san", 
         										"equilibrium"	);
         
         SS_ref_db.gbase[0] 		= di_eq.gb;
    -    SS_ref_db.gbase[1] 		= 0.045*z_b.P - 0.002*z_b.T + fs_eq.gb + 2.1;
    +    SS_ref_db.gbase[1] 		= 0.045*SS_ref_db.P - 0.002*SS_ref_db.T + fs_eq.gb + 2.1;
         SS_ref_db.gbase[2] 		= cats_eq.gb;
    -    SS_ref_db.gbase[3] 		= cats_eq.gb - jd_eq.gb + kos_eq.gb + 4.85;
    -    SS_ref_db.gbase[4] 		= acm_eq.gb + cats_eq.gb - jd_eq.gb - 3.46;
    -    SS_ref_db.gbase[5] 		= 0.248*z_b.P - 0.0012*z_b.T - cor_eq.gb/2. + cats_eq.gb + per_eq.gb/2. + ru_eq.gb/2. - 20.89;
    +    SS_ref_db.gbase[3] 		= cats_di.gb - jd_eq.gb + kos_eq.gb - 4.9;
    +    SS_ref_db.gbase[4] 		= acm_eq.gb + cats_di.gb - jd_eq.gb - 3.45;
    +    SS_ref_db.gbase[5] 		= -0.005*SS_ref_db.P - 0.0012*SS_ref_db.T - 0.5*cor_eq.gb + cats_di.gb + 0.5*per_eq.gb + 0.5*ru_eq.gb - 16.2;
         SS_ref_db.gbase[6] 		= jd_eq.gb;
    -    SS_ref_db.gbase[7] 		= 0.048*z_b.P - 0.002*z_b.T + en_eq.gb + 3.5;
    -    SS_ref_db.gbase[8] 		= 0.0465*z_b.P - 0.002*z_b.T + en_eq.gb/2. + fs_eq.gb/2. - 1.6;
    -    SS_ref_db.gbase[9] 		= 0.6*z_b.P - abh_eq.gb + san_eq.gb + jd_eq.gb + 10.82;
    +    SS_ref_db.gbase[7] 		= 0.048*SS_ref_db.P - 0.002*SS_ref_db.T + en_eq.gb + 3.5;
    +    SS_ref_db.gbase[8] 		= 0.0465*SS_ref_db.P - 0.002*SS_ref_db.T + 0.5*en_eq.gb + 0.5*fs_eq.gb - 1.6;
    +    SS_ref_db.gbase[9] 		= 0.6*SS_ref_db.P - abh_eq.gb + jd_eq.gb + san_eq.gb + 11.7;
         
         SS_ref_db.ElShearMod[0] 	= di_eq.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= fs_eq.ElShearMod;
         SS_ref_db.ElShearMod[2] 	= cats_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[3] 	= cats_eq.ElShearMod - jd_eq.ElShearMod + kos_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[4] 	= acm_eq.ElShearMod + cats_eq.ElShearMod - jd_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[5] 	= -cor_eq.ElShearMod/2. + cats_eq.ElShearMod + per_eq.ElShearMod/2. + ru_eq.ElShearMod/2.;
    +    SS_ref_db.ElShearMod[3] 	= cats_di.ElShearMod - jd_eq.ElShearMod + kos_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[4] 	= acm_eq.ElShearMod + cats_di.ElShearMod - jd_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[5] 	= -0.5*cor_eq.ElShearMod + cats_di.ElShearMod + 0.5*per_eq.ElShearMod + 0.5*ru_eq.ElShearMod;
         SS_ref_db.ElShearMod[6] 	= jd_eq.ElShearMod;
         SS_ref_db.ElShearMod[7] 	= en_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[8] 	= en_eq.ElShearMod/2. + fs_eq.ElShearMod/2.;
    -    SS_ref_db.ElShearMod[9] 	= -abh_eq.ElShearMod + san_eq.ElShearMod + jd_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[8] 	= 0.5*en_eq.ElShearMod + 0.5*fs_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[9] 	= -abh_eq.ElShearMod + jd_eq.ElShearMod + san_eq.ElShearMod;
         
         for (i = 0; i < len_ox; i++){
             SS_ref_db.Comp[0][i] 	= di_eq.C[i];
             SS_ref_db.Comp[1][i] 	= fs_eq.C[i];
             SS_ref_db.Comp[2][i] 	= cats_eq.C[i];
    -        SS_ref_db.Comp[3][i] 	= cats_eq.C[i] - jd_eq.C[i] + kos_eq.C[i];
    -        SS_ref_db.Comp[4][i] 	= acm_eq.C[i] + cats_eq.C[i] - jd_eq.C[i];
    -        SS_ref_db.Comp[5][i] 	= -cor_eq.C[i]/2. + cats_eq.C[i] + per_eq.C[i]/2. + ru_eq.C[i]/2.;
    +        SS_ref_db.Comp[3][i] 	= cats_di.C[i] - jd_eq.C[i] + kos_eq.C[i];
    +        SS_ref_db.Comp[4][i] 	= acm_eq.C[i] + cats_di.C[i] - jd_eq.C[i];
    +        SS_ref_db.Comp[5][i] 	= -0.5*cor_eq.C[i] + cats_di.C[i] + 0.5*per_eq.C[i] + 0.5*ru_eq.C[i];
             SS_ref_db.Comp[6][i] 	= jd_eq.C[i];
             SS_ref_db.Comp[7][i] 	= en_eq.C[i];
    -        SS_ref_db.Comp[8][i] 	= en_eq.C[i]/2. + fs_eq.C[i]/2.;
    -        SS_ref_db.Comp[9][i] 	= -abh_eq.C[i] + san_eq.C[i] + jd_eq.C[i];
    +        SS_ref_db.Comp[8][i] 	= 0.5*en_eq.C[i] + 0.5*fs_eq.C[i];
    +        SS_ref_db.Comp[9][i] 	= -abh_eq.C[i] + jd_eq.C[i] + san_eq.C[i];
         }
         
         for (i = 0; i < n_em; i++){
             SS_ref_db.z_em[i] = 1.0;
         };
         
    -    
         SS_ref_db.bounds_ref[0][0] = 0.0+eps;  SS_ref_db.bounds_ref[0][1] = 1.0-eps;
         SS_ref_db.bounds_ref[1][0] = 0.0+eps;  SS_ref_db.bounds_ref[1][1] = 2.0-eps;
         SS_ref_db.bounds_ref[2][0] = 0.0+eps;  SS_ref_db.bounds_ref[2][1] = 1.0-eps;
    @@ -6600,7 +2500,7 @@ 

    Source code for gss_function.c

         SS_ref_db.bounds_ref[6][0] = 0.0+eps;  SS_ref_db.bounds_ref[6][1] = 1.0-eps;
         SS_ref_db.bounds_ref[7][0] = 0.0+eps;  SS_ref_db.bounds_ref[7][1] = 1.0-eps;
         SS_ref_db.bounds_ref[8][0] = 0.0+eps;  SS_ref_db.bounds_ref[8][1] = 1.0-eps;
    -
    +    
     	if (z_b.bulk_rock[9] == 0.){ 					
     		SS_ref_db.z_em[3]          = 0.0;
             SS_ref_db.d_em[3]          = 1.0;
    @@ -6773,189 +2673,189 @@ 

    Source code for gss_function.c

         int i, j;
         int n_em = SS_ref_db.n_em;
         
    -    char   *EM_tmp[] 		= {"qfL","slfL","wofL","fofL","fafL","jdfL","hmfL","ekfL","tifL","kjfL","H2O"};
    +    char   *EM_tmp[] 		= {"qfL","slfL","wofL","fofL","fafL","jdfL","hmfL","ekfL","tifL","kjfL","h2o"};
         for (int i = 0; i < SS_ref_db.n_em; i++){
             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = 0.0;
    -    SS_ref_db.W[1] = 0.0;
    -    SS_ref_db.W[2] = 0.0;
    -    SS_ref_db.W[3] = 0.0;
    -    SS_ref_db.W[4] = 0.0;
    -    SS_ref_db.W[5] = 0.0;
    -    SS_ref_db.W[6] = 0.0;
    -    SS_ref_db.W[7] = 0.0;
    -    SS_ref_db.W[8] = 0.0;
    -    SS_ref_db.W[9] = 71.5 - 0.89*SS_ref_db.P;
    -    SS_ref_db.W[10] = 0.0;
    -    SS_ref_db.W[11] = 0.0;
    -    SS_ref_db.W[12] = 0.0;
    -    SS_ref_db.W[13] = 0.0;
    -    SS_ref_db.W[14] = 0.0;
    -    SS_ref_db.W[15] = 0.0;
    -    SS_ref_db.W[16] = 0.0;
    -    SS_ref_db.W[17] = 0.0;
    -    SS_ref_db.W[18] = 55.4 - 0.91*SS_ref_db.P;
    -    SS_ref_db.W[19] = 0.0;
    -    SS_ref_db.W[20] = 0.0;
    -    SS_ref_db.W[21] = 0.0;
    -    SS_ref_db.W[22] = 0.0;
    -    SS_ref_db.W[23] = 0.0;
    -    SS_ref_db.W[24] = 0.0;
    -    SS_ref_db.W[25] = 0.0;
    -    SS_ref_db.W[26] = 83.7 - 0.61*SS_ref_db.P;
    -    SS_ref_db.W[27] = 0.0;
    -    SS_ref_db.W[28] = 0.0;
    -    SS_ref_db.W[29] = 0.0;
    -    SS_ref_db.W[30] = 0.0;
    -    SS_ref_db.W[31] = 0.0;
    -    SS_ref_db.W[32] = 0.0;
    -    SS_ref_db.W[33] = 82.9 - 1.26*SS_ref_db.P;
    -    SS_ref_db.W[34] = 0.0;
    -    SS_ref_db.W[35] = 0.0;
    -    SS_ref_db.W[36] = 0.0;
    -    SS_ref_db.W[37] = 0.0;
    -    SS_ref_db.W[38] = 0.0;
    -    SS_ref_db.W[39] = 77.7 - 1.41*SS_ref_db.P;
    -    SS_ref_db.W[40] = 0.0;
    -    SS_ref_db.W[41] = 0.0;
    -    SS_ref_db.W[42] = 0.0;
    -    SS_ref_db.W[43] = 0.0;
    -    SS_ref_db.W[44] = 46.1 - 0.83*SS_ref_db.P;
    -    SS_ref_db.W[45] = 0.0;
    -    SS_ref_db.W[46] = 0.0;
    -    SS_ref_db.W[47] = 0.0;
    +    SS_ref_db.W[0] = 0;
    +    SS_ref_db.W[1] = 0;
    +    SS_ref_db.W[2] = 0;
    +    SS_ref_db.W[3] = 0;
    +    SS_ref_db.W[4] = 0;
    +    SS_ref_db.W[5] = 0;
    +    SS_ref_db.W[6] = 0;
    +    SS_ref_db.W[7] = 0;
    +    SS_ref_db.W[8] = 0;
    +    SS_ref_db.W[9] = 59.0 - 0.82*SS_ref_db.P;
    +    SS_ref_db.W[10] = 0;
    +    SS_ref_db.W[11] = 0;
    +    SS_ref_db.W[12] = 0;
    +    SS_ref_db.W[13] = 0;
    +    SS_ref_db.W[14] = 0;
    +    SS_ref_db.W[15] = 0;
    +    SS_ref_db.W[16] = 0;
    +    SS_ref_db.W[17] = 0;
    +    SS_ref_db.W[18] = 57.6 - 0.8*SS_ref_db.P;
    +    SS_ref_db.W[19] = 0;
    +    SS_ref_db.W[20] = 0;
    +    SS_ref_db.W[21] = 0;
    +    SS_ref_db.W[22] = 0;
    +    SS_ref_db.W[23] = 0;
    +    SS_ref_db.W[24] = 0;
    +    SS_ref_db.W[25] = 0;
    +    SS_ref_db.W[26] = 72.2 - 0.67*SS_ref_db.P;
    +    SS_ref_db.W[27] = 0;
    +    SS_ref_db.W[28] = 0;
    +    SS_ref_db.W[29] = 0;
    +    SS_ref_db.W[30] = 0;
    +    SS_ref_db.W[31] = 0;
    +    SS_ref_db.W[32] = 0;
    +    SS_ref_db.W[33] = 71.7 - 1.1*SS_ref_db.P;
    +    SS_ref_db.W[34] = 0;
    +    SS_ref_db.W[35] = 0;
    +    SS_ref_db.W[36] = 0;
    +    SS_ref_db.W[37] = 0;
    +    SS_ref_db.W[38] = 0;
    +    SS_ref_db.W[39] = 71.7 - 1.1*SS_ref_db.P;
    +    SS_ref_db.W[40] = 0;
    +    SS_ref_db.W[41] = 0;
    +    SS_ref_db.W[42] = 0;
    +    SS_ref_db.W[43] = 0;
    +    SS_ref_db.W[44] = 57.0 - 0.79*SS_ref_db.P;
    +    SS_ref_db.W[45] = 0;
    +    SS_ref_db.W[46] = 0;
    +    SS_ref_db.W[47] = 0;
         SS_ref_db.W[48] = 73.0 - 0.66*SS_ref_db.P;
    -    SS_ref_db.W[49] = 0.0;
    -    SS_ref_db.W[50] = 0.0;
    +    SS_ref_db.W[49] = 0;
    +    SS_ref_db.W[50] = 0;
         SS_ref_db.W[51] = 73.0 - 0.66*SS_ref_db.P;
    -    SS_ref_db.W[52] = 0.0;
    -    SS_ref_db.W[53] = 75.9 - 0.66*SS_ref_db.P;
    -    SS_ref_db.W[54] = 49.6 - 1.31*SS_ref_db.P;
    +    SS_ref_db.W[52] = 0;
    +    SS_ref_db.W[53] = 75.0 - 0.67*SS_ref_db.P;
    +    SS_ref_db.W[54] = 44.9 - 1.19*SS_ref_db.P;
         
         
         em_data qL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"qL", 
         										"equilibrium"	);
         
    -    em_data silL_eq 		= get_em_data(		EM_database, 
    +    em_data silL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"silL", 
         										"equilibrium"	);
         
         em_data woL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"woL", 
         										"equilibrium"	);
         
         em_data foL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"foL", 
         										"equilibrium"	);
         
         em_data faL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"faL", 
         										"equilibrium"	);
         
         em_data abL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"abL", 
         										"equilibrium"	);
         
    -    em_data hemL_eq 		= get_em_data(		EM_database, 
    +    em_data hemL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"hemL", 
         										"equilibrium"	);
         
    -    em_data eskL_eq 		= get_em_data(		EM_database, 
    +    em_data eskL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"eskL", 
         										"equilibrium"	);
         
         em_data ruL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"ruL", 
         										"equilibrium"	);
         
    -    em_data kspL_eq 		= get_em_data(		EM_database, 
    +    em_data kspL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"kspL", 
         										"equilibrium"	);
         
         em_data H2O_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"H2O", 
         										"equilibrium"	);
         
    -    SS_ref_db.gbase[0] 		= -0.071*z_b.P + 4*qL_eq.gb + 2.65;
    -    SS_ref_db.gbase[1] 		= -0.386*z_b.P + silL_eq.gb + 6.29;
    -    SS_ref_db.gbase[2] 		= -0.161*z_b.P + woL_eq.gb - 0.2;
    -    SS_ref_db.gbase[3] 		= -0.125*z_b.P + 2*foL_eq.gb + 7.56;
    -    SS_ref_db.gbase[4] 		= -0.103*z_b.P + 2*faL_eq.gb + 15.54;
    -    SS_ref_db.gbase[5] 		= -0.385*z_b.P + abL_eq.gb - qL_eq.gb + 10.59;
    -    SS_ref_db.gbase[6] 		= -0.077*z_b.P + hemL_eq.gb/2 + 4.05;
    -    SS_ref_db.gbase[7] 		= 0.245*z_b.P + eskL_eq.gb/2 + 24.75;
    -    SS_ref_db.gbase[8] 		= -0.484*z_b.P + ruL_eq.gb + 5.69;
    -    SS_ref_db.gbase[9] 		= -0.345*z_b.P + kspL_eq.gb - qL_eq.gb + 12.21;
    +    SS_ref_db.gbase[0] 		= -0.051*SS_ref_db.P + 4.0*qL_eq.gb + 2.1;
    +    SS_ref_db.gbase[1] 		= -0.313*SS_ref_db.P + silL_eq.gb + 6.72;
    +    SS_ref_db.gbase[2] 		= -0.12*SS_ref_db.P + woL_eq.gb + 0.22;
    +    SS_ref_db.gbase[3] 		= -0.136*SS_ref_db.P + 2.0*foL_eq.gb + 8.59;
    +    SS_ref_db.gbase[4] 		= -0.052*SS_ref_db.P + 2.0*faL_eq.gb + 13.56;
    +    SS_ref_db.gbase[5] 		= -0.099*SS_ref_db.P + abL_eq.gb - qL_eq.gb + 12.32;
    +    SS_ref_db.gbase[6] 		= -0.077*SS_ref_db.P + 0.5*hemL_eq.gb + 4.05;
    +    SS_ref_db.gbase[7] 		=  0.245*SS_ref_db.P + 0.5*eskL_eq.gb + 24.75;
    +    SS_ref_db.gbase[8] 		= -0.489*SS_ref_db.P + ruL_eq.gb + 5.6;
    +    SS_ref_db.gbase[9] 		= -0.227*SS_ref_db.P + kspL_eq.gb - qL_eq.gb + 12.88;
         SS_ref_db.gbase[10] 		= H2O_eq.gb;
         
    -    SS_ref_db.ElShearMod[0] 	= 4.*qL_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[0] 	= 4.0*qL_eq.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= silL_eq.ElShearMod;
         SS_ref_db.ElShearMod[2] 	= woL_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[3] 	= 2.*foL_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[4] 	= 2.*faL_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[3] 	= 2.0*foL_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[4] 	= 2.0*faL_eq.ElShearMod;
         SS_ref_db.ElShearMod[5] 	= abL_eq.ElShearMod - qL_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[6] 	= hemL_eq.ElShearMod/2.;
    -    SS_ref_db.ElShearMod[7] 	= eskL_eq.ElShearMod/2.;
    +    SS_ref_db.ElShearMod[6] 	= 0.5*hemL_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[7] 	= 0.5*eskL_eq.ElShearMod;
         SS_ref_db.ElShearMod[8] 	= ruL_eq.ElShearMod;
         SS_ref_db.ElShearMod[9] 	= kspL_eq.ElShearMod - qL_eq.ElShearMod;
         SS_ref_db.ElShearMod[10] 	= H2O_eq.ElShearMod;
         
         for (i = 0; i < len_ox; i++){
    -        SS_ref_db.Comp[0][i] 	= 4.*qL_eq.C[i];
    +        SS_ref_db.Comp[0][i] 	= 4.0*qL_eq.C[i];
             SS_ref_db.Comp[1][i] 	= silL_eq.C[i];
             SS_ref_db.Comp[2][i] 	= woL_eq.C[i];
    -        SS_ref_db.Comp[3][i] 	= 2.*foL_eq.C[i];
    -        SS_ref_db.Comp[4][i] 	= 2.*faL_eq.C[i];
    +        SS_ref_db.Comp[3][i] 	= 2.0*foL_eq.C[i];
    +        SS_ref_db.Comp[4][i] 	= 2.0*faL_eq.C[i];
             SS_ref_db.Comp[5][i] 	= abL_eq.C[i] - qL_eq.C[i];
    -        SS_ref_db.Comp[6][i] 	= hemL_eq.C[i]/2.;
    -        SS_ref_db.Comp[7][i] 	= eskL_eq.C[i]/2.;
    +        SS_ref_db.Comp[6][i] 	= 0.5*hemL_eq.C[i];
    +        SS_ref_db.Comp[7][i] 	= 0.5*eskL_eq.C[i];
             SS_ref_db.Comp[8][i] 	= ruL_eq.C[i];
             SS_ref_db.Comp[9][i] 	= kspL_eq.C[i] - qL_eq.C[i];
             SS_ref_db.Comp[10][i] 	= H2O_eq.C[i];
    @@ -7102,8 +3002,8 @@ 

    Source code for gss_function.c

         SS_ref_db.gbase[1] 		= alm_eq.gb;
         SS_ref_db.gbase[2] 		= gr_eq.gb;
         SS_ref_db.gbase[3] 		= andr_eq.gb;
    -    SS_ref_db.gbase[4] 		= knor_eq.gb;
    -    SS_ref_db.gbase[5] 		= -0.0173*SS_ref_db.T - 0.5*cor_eq.gb + 0.5*per_eq.gb + py_eq.gb + 0.5*ru_eq.gb + 53.5;
    +    SS_ref_db.gbase[4] 		= knor_eq.gb + 18.2;
    +    SS_ref_db.gbase[5] 		= -0.0173*SS_ref_db.T - 0.5*cor_eq.gb + 0.5*per_eq.gb + py_eq.gb + 0.5*ru_eq.gb + 46.7;
         
         SS_ref_db.ElShearMod[0] 	= py_eq.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= alm_eq.ElShearMod;
    @@ -7130,7 +3030,7 @@ 

    Source code for gss_function.c

         SS_ref_db.bounds_ref[2][0] = 0.0+eps;  SS_ref_db.bounds_ref[2][1] = 1.0-eps;
         SS_ref_db.bounds_ref[3][0] = 0.0+eps;  SS_ref_db.bounds_ref[3][1] = 1.0-eps;
         SS_ref_db.bounds_ref[4][0] = 0.0+eps;  SS_ref_db.bounds_ref[4][1] = 1.0-eps;
    -
    +    
     	if (z_b.bulk_rock[9] == 0.){ 					
     		SS_ref_db.z_em[4]          = 0.0;
             SS_ref_db.d_em[4]          = 1.0;
    @@ -7397,81 +3297,52 @@ 

    Source code for gss_function.c

         int i, j;
         int n_em = SS_ref_db.n_em;
         
    -    char   *EM_tmp[] 		= {"oilm","dilm","hm","ogk","dgk"};
    +    char   *EM_tmp[] 		= {"oilm","dilm","dhem"};
         for (int i = 0; i < SS_ref_db.n_em; i++){
             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = 0.13*SS_ref_db.P + 7.05;
    -    SS_ref_db.W[1] = 14.30;
    -    SS_ref_db.W[2] = -7.60;
    -    SS_ref_db.W[3] = 0.60;
    -    SS_ref_db.W[4] = 7.25 - 0.13*SS_ref_db.P;
    -    SS_ref_db.W[5] = -5.50;
    -    SS_ref_db.W[6] = -2.20;
    -    SS_ref_db.W[7] = 12.50;
    -    SS_ref_db.W[8] = 2.70;
    -    SS_ref_db.W[9] = 8.30;
    +    SS_ref_db.W[0] = 7.05;
    +    SS_ref_db.W[1] = 14.3;
    +    SS_ref_db.W[2] = 7.25;
         
         
         em_data ilm_or 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"ilm", 
         										"ordered"	);
         
         em_data ilm_di 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"ilm", 
         										"disordered"	);
         
         em_data hem_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"hem", 
         										"equilibrium"	);
         
    -    em_data geik_or 		= get_em_data(	EM_database, 
    -    										len_ox,
    -    										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"geik", 
    -    										"ordered"	);
    -    
    -    em_data geik_di 		= get_em_data(	EM_database, 
    -    										len_ox,
    -    										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"geik", 
    -    										"disordered"	);
    -    
         SS_ref_db.gbase[0] 		= ilm_or.gb;
         SS_ref_db.gbase[1] 		= ilm_di.gb;
         SS_ref_db.gbase[2] 		= hem_eq.gb;
    -    SS_ref_db.gbase[3] 		= geik_or.gb;
    -    SS_ref_db.gbase[4] 		= geik_di.gb;
         
         SS_ref_db.ElShearMod[0] 	= ilm_or.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= ilm_di.ElShearMod;
         SS_ref_db.ElShearMod[2] 	= hem_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[3] 	= geik_or.ElShearMod;
    -    SS_ref_db.ElShearMod[4] 	= geik_di.ElShearMod;
         
         for (i = 0; i < len_ox; i++){
             SS_ref_db.Comp[0][i] 	= ilm_or.C[i];
             SS_ref_db.Comp[1][i] 	= ilm_di.C[i];
             SS_ref_db.Comp[2][i] 	= hem_eq.C[i];
    -        SS_ref_db.Comp[3][i] 	= geik_or.C[i];
    -        SS_ref_db.Comp[4][i] 	= geik_di.C[i];
         }
         
         for (i = 0; i < n_em; i++){
    @@ -7479,10 +3350,7 @@ 

    Source code for gss_function.c

         };
         
         SS_ref_db.bounds_ref[0][0] = 0.0+eps;  SS_ref_db.bounds_ref[0][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[1][0] = 0.0+eps;  SS_ref_db.bounds_ref[1][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[2][0] = -1.0+eps;  SS_ref_db.bounds_ref[2][1] = 1.0-eps;
    -    SS_ref_db.bounds_ref[3][0] = -1.0+eps;  SS_ref_db.bounds_ref[3][1] = 1.0-eps;
    -
    +    SS_ref_db.bounds_ref[1][0] = -0.99+eps;  SS_ref_db.bounds_ref[1][1] = 0.99-eps;
     
     	if (z_b.bulk_rock[8] == 0.){ 					
     		SS_ref_db.z_em[2]          = 0.0;
    @@ -7490,8 +3358,6 @@ 

    Source code for gss_function.c

     		SS_ref_db.bounds_ref[0][0] = 1.0; 
     		SS_ref_db.bounds_ref[0][1] = 1.0;	
     	}
    -    
    -
         return SS_ref_db;
     }
    [docs]/** @@ -7502,77 +3368,77 @@

    Source code for gss_function.c

         int i, j;
         int n_em = SS_ref_db.n_em;
         
    -    char   *EM_tmp[] 		= {"q4L","slL","wo1L","fo2L","fa2L","jdL","hmL","ekL","tiL","kjL","ctL","wat1L"};
    +    char   *EM_tmp[] 		= {"q4L","sl1L","wo1L","fo2L","fa2L","jdL","hmL","ekL","tiL","kjL","ctL","h2o1L"};
         for (int i = 0; i < SS_ref_db.n_em; i++){
             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = 9.2 - 0.08*SS_ref_db.P;
    +    SS_ref_db.W[0] = 9.5 - 0.1*SS_ref_db.P;
         SS_ref_db.W[1] = -10.3;
    -    SS_ref_db.W[2] = -4.31*SS_ref_db.P - 47.6;
    -    SS_ref_db.W[3] = -0.53*SS_ref_db.P - 13.1;
    -    SS_ref_db.W[4] = -0.11*SS_ref_db.P - 15.5;
    +    SS_ref_db.W[2] = -3.12*SS_ref_db.P - 26.5;
    +    SS_ref_db.W[3] = -0.55*SS_ref_db.P - 12.0;
    +    SS_ref_db.W[4] = -0.13*SS_ref_db.P - 15.1;
         SS_ref_db.W[5] = 20.0;
    -    SS_ref_db.W[6] = 0.0;
    -    SS_ref_db.W[7] = 24.1;
    -    SS_ref_db.W[8] = -0.05*SS_ref_db.P - 20.1;
    -    SS_ref_db.W[9] = 0.03*SS_ref_db.P - 14.2;
    -    SS_ref_db.W[10] = 18.7 - 0.71*SS_ref_db.P;
    -    SS_ref_db.W[11] = 0.83*SS_ref_db.P - 28.5;
    -    SS_ref_db.W[12] = 0.1*SS_ref_db.P + 1.2;
    +    SS_ref_db.W[6] = 0;
    +    SS_ref_db.W[7] = 24.6;
    +    SS_ref_db.W[8] = -0.05*SS_ref_db.P - 17.8;
    +    SS_ref_db.W[9] = -14.6;
    +    SS_ref_db.W[10] = 17.8 - 0.61*SS_ref_db.P;
    +    SS_ref_db.W[11] = 0.85*SS_ref_db.P - 26.5;
    +    SS_ref_db.W[12] = 2.2;
         SS_ref_db.W[13] = 2.5;
    -    SS_ref_db.W[14] = 0.04*SS_ref_db.P + 18.8;
    +    SS_ref_db.W[14] = 16.8;
         SS_ref_db.W[15] = -5.0;
    -    SS_ref_db.W[16] = 0.0;
    -    SS_ref_db.W[17] = 16.2 - 0.04*SS_ref_db.P;
    -    SS_ref_db.W[18] = 0.1*SS_ref_db.P + 6.9;
    -    SS_ref_db.W[19] = 3.7;
    -    SS_ref_db.W[20] = 24.3 - 0.94*SS_ref_db.P;
    -    SS_ref_db.W[21] = 0.07*SS_ref_db.P + 25.9;
    -    SS_ref_db.W[22] = 13.9;
    -    SS_ref_db.W[23] = 0.1 - 0.03*SS_ref_db.P;
    -    SS_ref_db.W[24] = 0.0;
    -    SS_ref_db.W[25] = 0.0;
    -    SS_ref_db.W[26] = 17.9;
    -    SS_ref_db.W[27] = 0.1*SS_ref_db.P - 0.5;
    -    SS_ref_db.W[28] = 9.6 - 0.04*SS_ref_db.P;
    -    SS_ref_db.W[29] = 53.2 - 1.1*SS_ref_db.P;
    -    SS_ref_db.W[30] = 0.03*SS_ref_db.P + 17.9;
    -    SS_ref_db.W[31] = 0.07*SS_ref_db.P + 0.1;
    -    SS_ref_db.W[32] = 0.0;
    -    SS_ref_db.W[33] = 0.0;
    -    SS_ref_db.W[34] = 9.0;
    -    SS_ref_db.W[35] = 0.07*SS_ref_db.P + 3.8;
    -    SS_ref_db.W[36] = -7.6;
    -    SS_ref_db.W[37] = 21.0 - 1.67*SS_ref_db.P;
    -    SS_ref_db.W[38] = 8.3 - 0.04*SS_ref_db.P;
    +    SS_ref_db.W[16] = 0;
    +    SS_ref_db.W[17] = 15.2 - 0.04*SS_ref_db.P;
    +    SS_ref_db.W[18] = 7.0;
    +    SS_ref_db.W[19] = 4.0;
    +    SS_ref_db.W[20] = 23.7 - 0.94*SS_ref_db.P;
    +    SS_ref_db.W[21] = 0.11*SS_ref_db.P + 25.5;
    +    SS_ref_db.W[22] = 14.0;
    +    SS_ref_db.W[23] = -1.2;
    +    SS_ref_db.W[24] = 0;
    +    SS_ref_db.W[25] = 0;
    +    SS_ref_db.W[26] = 18.0;
    +    SS_ref_db.W[27] = -1.1;
    +    SS_ref_db.W[28] = 9.5;
    +    SS_ref_db.W[29] = 40.3 - 0.86*SS_ref_db.P;
    +    SS_ref_db.W[30] = 18.0;
    +    SS_ref_db.W[31] = 1.5;
    +    SS_ref_db.W[32] = 0;
    +    SS_ref_db.W[33] = 0;
    +    SS_ref_db.W[34] = 7.5;
    +    SS_ref_db.W[35] = 3.0;
    +    SS_ref_db.W[36] = -5.6;
    +    SS_ref_db.W[37] = 9.4 - 1.58*SS_ref_db.P;
    +    SS_ref_db.W[38] = 7.5 - 0.05*SS_ref_db.P;
         SS_ref_db.W[39] = -30.0;
    -    SS_ref_db.W[40] = 0.0;
    -    SS_ref_db.W[41] = -4.1;
    -    SS_ref_db.W[42] = 0.1*SS_ref_db.P + 9.4;
    -    SS_ref_db.W[43] = -6.1;
    -    SS_ref_db.W[44] = 20.9 - 1.6*SS_ref_db.P;
    -    SS_ref_db.W[45] = 0.01*SS_ref_db.P + 9.8;
    -    SS_ref_db.W[46] = 0.0;
    -    SS_ref_db.W[47] = 0.14*SS_ref_db.P + 15.4;
    -    SS_ref_db.W[48] = 0.1*SS_ref_db.P - 4.7;
    -    SS_ref_db.W[49] = 6.8;
    -    SS_ref_db.W[50] = -0.06*SS_ref_db.P - 10.1;
    -    SS_ref_db.W[51] = 0.0;
    -    SS_ref_db.W[52] = 0.0;
    -    SS_ref_db.W[53] = 0.1*SS_ref_db.P + 8.9;
    -    SS_ref_db.W[54] = 0.0;
    -    SS_ref_db.W[55] = 57.4 - 0.66*SS_ref_db.P;
    -    SS_ref_db.W[56] = 0.0;
    -    SS_ref_db.W[57] = 0.0;
    -    SS_ref_db.W[58] = 0.0;
    +    SS_ref_db.W[40] = 0;
    +    SS_ref_db.W[41] = 6.7;
    +    SS_ref_db.W[42] = 10.0;
    +    SS_ref_db.W[43] = -6.5;
    +    SS_ref_db.W[44] = 9.2 - 1.58*SS_ref_db.P;
    +    SS_ref_db.W[45] = 10.0;
    +    SS_ref_db.W[46] = 0;
    +    SS_ref_db.W[47] = 0.14*SS_ref_db.P + 16.5;
    +    SS_ref_db.W[48] = -5.9;
    +    SS_ref_db.W[49] = 7.6;
    +    SS_ref_db.W[50] = -0.06*SS_ref_db.P - 8.3;
    +    SS_ref_db.W[51] = 0;
    +    SS_ref_db.W[52] = 0;
    +    SS_ref_db.W[53] = 10.0;
    +    SS_ref_db.W[54] = 0;
    +    SS_ref_db.W[55] = 60.0 - 0.66*SS_ref_db.P;
    +    SS_ref_db.W[56] = 0;
    +    SS_ref_db.W[57] = 0;
    +    SS_ref_db.W[58] = 0;
         SS_ref_db.W[59] = 30.0 - 0.66*SS_ref_db.P;
    -    SS_ref_db.W[60] = 0.04*SS_ref_db.P + 9.6;
    -    SS_ref_db.W[61] = 0.0;
    -    SS_ref_db.W[62] = 29.2 - 0.6*SS_ref_db.P;
    -    SS_ref_db.W[63] = -5.4;
    -    SS_ref_db.W[64] = 0.06*SS_ref_db.P + 2.0;
    -    SS_ref_db.W[65] = 8.9 - 0.03*SS_ref_db.P;
    +    SS_ref_db.W[60] = 9.0;
    +    SS_ref_db.W[61] = 0;
    +    SS_ref_db.W[62] = 30.0 - 0.6*SS_ref_db.P;
    +    SS_ref_db.W[63] = -5.6;
    +    SS_ref_db.W[64] = 0.22*SS_ref_db.P - 0.1;
    +    SS_ref_db.W[65] = 0.05*SS_ref_db.P + 17.3;
         
         SS_ref_db.v[0] = 100.0;
         SS_ref_db.v[1] = 120.0;
    @@ -7585,109 +3451,109 @@ 

    Source code for gss_function.c

         SS_ref_db.v[8] = 100.0;
         SS_ref_db.v[9] = 100.0;
         SS_ref_db.v[10] = 100.0;
    -    SS_ref_db.v[11] = 65.0;
    +    SS_ref_db.v[11] = 100.0;
         
         
         em_data qL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"qL", 
         										"equilibrium"	);
         
    -    em_data silL_eq 		= get_em_data(		EM_database, 
    +    em_data silL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"silL", 
         										"equilibrium"	);
         
         em_data woL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"woL", 
         										"equilibrium"	);
         
         em_data foL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"foL", 
         										"equilibrium"	);
         
         em_data faL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"faL", 
         										"equilibrium"	);
         
         em_data abL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"abL", 
         										"equilibrium"	);
         
    -    em_data hemL_eq 		= get_em_data(		EM_database, 
    +    em_data hemL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"hemL", 
         										"equilibrium"	);
         
    -    em_data eskL_eq 		= get_em_data(		EM_database, 
    +    em_data eskL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"eskL", 
         										"equilibrium"	);
         
         em_data ruL_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"ruL", 
         										"equilibrium"	);
         
    -    em_data kspL_eq 		= get_em_data(		EM_database, 
    +    em_data kspL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"kspL", 
         										"equilibrium"	);
         
    -    em_data h2oL_eq 		= get_em_data(		EM_database, 
    +    em_data h2oL_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"h2oL", 
         										"equilibrium"	);
         
    -    SS_ref_db.gbase[0] 		= -0.033*z_b.P + 4.0*qL_eq.gb + 1.3;
    -    SS_ref_db.gbase[1] 		= -0.332*z_b.P + silL_eq.gb + 6.37;
    -    SS_ref_db.gbase[2] 		= -0.127*z_b.P + woL_eq.gb + 0.62;
    -    SS_ref_db.gbase[3] 		= -0.155*z_b.P + 2.0*foL_eq.gb + 7.72;
    -    SS_ref_db.gbase[4] 		= -0.053*z_b.P + 2.0*faL_eq.gb + 13.86;
    -    SS_ref_db.gbase[5] 		= -0.091*z_b.P + abL_eq.gb - qL_eq.gb + 11.38;
    -    SS_ref_db.gbase[6] 		= -0.039*z_b.P + 0.5*hemL_eq.gb + 3.0;
    -    SS_ref_db.gbase[7] 		= 0.244*z_b.P + 0.5*eskL_eq.gb + 25.17;
    -    SS_ref_db.gbase[8] 		= -0.224*z_b.P + ruL_eq.gb - 6.41;
    -    SS_ref_db.gbase[9] 		= -0.204*z_b.P + kspL_eq.gb - qL_eq.gb + 11.91;
    -    SS_ref_db.gbase[10] 		= 0.051*z_b.P + 0.055*z_b.T - qL_eq.gb + silL_eq.gb + woL_eq.gb - 106.74;
    -    SS_ref_db.gbase[11] 		= 0.00065*z_b.P - 0.0041*z_b.T + h2oL_eq.gb + 3.59;
    +    SS_ref_db.gbase[0] 		= -0.059*SS_ref_db.P + 4.0*qL_eq.gb + 0.22;
    +    SS_ref_db.gbase[1] 		= -0.318*SS_ref_db.P + silL_eq.gb + 6.2;
    +    SS_ref_db.gbase[2] 		= -0.114*SS_ref_db.P + woL_eq.gb - 0.45;
    +    SS_ref_db.gbase[3] 		= -0.131*SS_ref_db.P + 2.0*foL_eq.gb + 8.67;
    +    SS_ref_db.gbase[4] 		= -0.055*SS_ref_db.P + 2.0*faL_eq.gb + 13.7;
    +    SS_ref_db.gbase[5] 		= -0.089*SS_ref_db.P + abL_eq.gb - qL_eq.gb + 12.19;
    +    SS_ref_db.gbase[6] 		= -0.032*SS_ref_db.P + 0.5*hemL_eq.gb + 3.3;
    +    SS_ref_db.gbase[7] 		= 0.245*SS_ref_db.P + 0.5*eskL_eq.gb + 24.85;
    +    SS_ref_db.gbase[8] 		= -0.489*SS_ref_db.P + ruL_eq.gb + 5.58;
    +    SS_ref_db.gbase[9] 		= -0.21*SS_ref_db.P + kspL_eq.gb - qL_eq.gb + 11.98;
    +    SS_ref_db.gbase[10] 		= 0.053*SS_ref_db.P + 0.055*SS_ref_db.T - qL_eq.gb + silL_eq.gb + woL_eq.gb - 108.3;
    +    SS_ref_db.gbase[11] 		= 0.00087*SS_ref_db.P - 0.0039*SS_ref_db.T + h2oL_eq.gb + 3.2;
         
         SS_ref_db.ElShearMod[0] 	= 4.0*qL_eq.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= silL_eq.ElShearMod;
    @@ -7754,143 +3620,6 @@ 

    Source code for gss_function.c

     }
    - -
    [docs]/** - retrieve reference thermodynamic data for muscovite -*/ -SS_ref G_SS_ig_mu_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){ - - int i, j; - int n_em = SS_ref_db.n_em; - - char *EM_tmp[] = {"mu","cel","fcel","pa","mam","fmu"}; - for (int i = 0; i < SS_ref_db.n_em; i++){ - strcpy(SS_ref_db.EM_list[i],EM_tmp[i]); - }; - - SS_ref_db.W[0] = 0.2*SS_ref_db.P; - SS_ref_db.W[1] = 0.2*SS_ref_db.P; - SS_ref_db.W[2] = 0.353*SS_ref_db.P + 0.0034*SS_ref_db.T + 10.12; - SS_ref_db.W[3] = 35.0; - SS_ref_db.W[4] = 0.0; - SS_ref_db.W[5] = 0.0; - SS_ref_db.W[6] = 0.25*SS_ref_db.P + 45.0; - SS_ref_db.W[7] = 50.0; - SS_ref_db.W[8] = 0.0; - SS_ref_db.W[9] = 0.25*SS_ref_db.P + 45.0; - SS_ref_db.W[10] = 50.0; - SS_ref_db.W[11] = 0.0; - SS_ref_db.W[12] = 15.0; - SS_ref_db.W[13] = 30.0; - SS_ref_db.W[14] = 35.0; - - SS_ref_db.v[0] = 0.63; - SS_ref_db.v[1] = 0.63; - SS_ref_db.v[2] = 0.63; - SS_ref_db.v[3] = 0.37; - SS_ref_db.v[4] = 0.63; - SS_ref_db.v[5] = 0.63; - - - em_data mu_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "mu", - "equilibrium" ); - - em_data cel_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "cel", - "equilibrium" ); - - em_data fcel_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "fcel", - "equilibrium" ); - - em_data pa_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "pa", - "equilibrium" ); - - em_data ma_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "ma", - "equilibrium" ); - - em_data gr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "gr", - "equilibrium" ); - - em_data andr_eq = get_em_data( EM_database, - len_ox, - z_b, - SS_ref_db.P, - SS_ref_db.T, - "andr", - "equilibrium" ); - - SS_ref_db.gbase[0] = mu_eq.gb; - SS_ref_db.gbase[1] = cel_eq.gb; - SS_ref_db.gbase[2] = fcel_eq.gb; - SS_ref_db.gbase[3] = pa_eq.gb; - SS_ref_db.gbase[4] = ma_eq.gb + 6.5; - SS_ref_db.gbase[5] = 0.5*andr_eq.gb - 0.5*gr_eq.gb + mu_eq.gb + 25.0; - - SS_ref_db.ElShearMod[0] = mu_eq.ElShearMod; - SS_ref_db.ElShearMod[1] = cel_eq.ElShearMod; - SS_ref_db.ElShearMod[2] = fcel_eq.ElShearMod; - SS_ref_db.ElShearMod[3] = pa_eq.ElShearMod; - SS_ref_db.ElShearMod[4] = ma_eq.ElShearMod; - SS_ref_db.ElShearMod[5] = 0.5*andr_eq.ElShearMod - 0.5*gr_eq.ElShearMod + mu_eq.ElShearMod; - - for (i = 0; i < len_ox; i++){ - SS_ref_db.Comp[0][i] = mu_eq.C[i]; - SS_ref_db.Comp[1][i] = cel_eq.C[i]; - SS_ref_db.Comp[2][i] = fcel_eq.C[i]; - SS_ref_db.Comp[3][i] = pa_eq.C[i]; - SS_ref_db.Comp[4][i] = ma_eq.C[i]; - SS_ref_db.Comp[5][i] = 0.5*andr_eq.C[i] - 0.5*gr_eq.C[i] + mu_eq.C[i]; - } - - for (i = 0; i < n_em; i++){ - SS_ref_db.z_em[i] = 1.0; - }; - - SS_ref_db.bounds_ref[0][0] = 0.0+eps; SS_ref_db.bounds_ref[0][1] = 1.0-eps; - SS_ref_db.bounds_ref[1][0] = 0.0+eps; SS_ref_db.bounds_ref[1][1] = 1.0-eps; - SS_ref_db.bounds_ref[2][0] = 0.0+eps; SS_ref_db.bounds_ref[2][1] = 1.0-eps; - SS_ref_db.bounds_ref[3][0] = 0.0+eps; SS_ref_db.bounds_ref[3][1] = 1.0-eps; - SS_ref_db.bounds_ref[4][0] = 0.0+eps; SS_ref_db.bounds_ref[4][1] = 1.0-eps; - - /* define box bounds according to bulk-rock */ - if (z_b.bulk_rock[8] == 0.){ - SS_ref_db.z_em[5] = 0.0; - SS_ref_db.bounds_ref[2][0] = eps; - SS_ref_db.bounds_ref[2][1] = eps; - } - - return SS_ref_db; -}
    -
    [docs]/** retrieve reference thermodynamic data for olivine */ @@ -7968,7 +3697,7 @@

    Source code for gss_function.c

       retrieve reference thermodynamic data for orthopyroxene
     */
     SS_ref G_SS_ig_opx_function(SS_ref SS_ref_db, int EM_database, int len_ox, bulk_info z_b, double eps){
    -    
    +  
         int i, j;
         int n_em = SS_ref_db.n_em;
         
    @@ -7977,162 +3706,162 @@ 

    Source code for gss_function.c

             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = 7.000;
    -    SS_ref_db.W[1] = 3.500;
    -    SS_ref_db.W[2] = 0.15*SS_ref_db.P + 29.0;
    +    SS_ref_db.W[0] = 7.0;
    +    SS_ref_db.W[1] = 4.0;
    +    SS_ref_db.W[2] = 29.4;
         SS_ref_db.W[3] = 12.5 - 0.04*SS_ref_db.P;
    -    SS_ref_db.W[4] = 8.000;
    -    SS_ref_db.W[5] = 6.000;
    -    SS_ref_db.W[6] = 8.000;
    -    SS_ref_db.W[7] = 35.00;
    -    SS_ref_db.W[8] = 4.500;
    -    SS_ref_db.W[9] = 0.08*SS_ref_db.P + 23.0;
    +    SS_ref_db.W[4] = 8.0;
    +    SS_ref_db.W[5] = 6.0;
    +    SS_ref_db.W[6] = 8.0;
    +    SS_ref_db.W[7] = 35.0;
    +    SS_ref_db.W[8] = 4.0;
    +    SS_ref_db.W[9] = 0.08*SS_ref_db.P + 21.5;
         SS_ref_db.W[10] = 11.0 - 0.15*SS_ref_db.P;
    -    SS_ref_db.W[11] = 10.00;
    -    SS_ref_db.W[12] = 7.000;
    -    SS_ref_db.W[13] = 10.00;
    -    SS_ref_db.W[14] = 35.00;
    -    SS_ref_db.W[15] = 0.08*SS_ref_db.P + 19.0;
    +    SS_ref_db.W[11] = 10.0;
    +    SS_ref_db.W[12] = 7.0;
    +    SS_ref_db.W[13] = 10.0;
    +    SS_ref_db.W[14] = 35.0;
    +    SS_ref_db.W[15] = 0.08*SS_ref_db.P + 18.0;
         SS_ref_db.W[16] = 15.0 - 0.15*SS_ref_db.P;
    -    SS_ref_db.W[17] = 12.00;
    -    SS_ref_db.W[18] = 8.000;
    -    SS_ref_db.W[19] = 12.00;
    -    SS_ref_db.W[20] = 35.00;
    +    SS_ref_db.W[17] = 12.0;
    +    SS_ref_db.W[18] = 8.0;
    +    SS_ref_db.W[19] = 12.0;
    +    SS_ref_db.W[20] = 35.0;
         SS_ref_db.W[21] = 75.5 - 0.84*SS_ref_db.P;
    -    SS_ref_db.W[22] = 20.00;
    -    SS_ref_db.W[23] = 40.00;
    -    SS_ref_db.W[24] = 20.00;
    -    SS_ref_db.W[25] = 35.00;
    -    SS_ref_db.W[26] = 2.000;
    -    SS_ref_db.W[27] = 10.00;
    -    SS_ref_db.W[28] = 2.000;
    -    SS_ref_db.W[29] = 7.000;
    -    SS_ref_db.W[30] = 6.000;
    -    SS_ref_db.W[31] = 2.000;
    -    SS_ref_db.W[32] = -11.00;
    -    SS_ref_db.W[33] = 6.000;
    -    SS_ref_db.W[34] = 20.00;
    -    SS_ref_db.W[35] = -11.00;
    +    SS_ref_db.W[22] = 20.0;
    +    SS_ref_db.W[23] = 40.0;
    +    SS_ref_db.W[24] = 20.0;
    +    SS_ref_db.W[25] = 35.0;
    +    SS_ref_db.W[26] = 2.0;
    +    SS_ref_db.W[27] = 10.0;
    +    SS_ref_db.W[28] = 2.0;
    +    SS_ref_db.W[29] = 7.0;
    +    SS_ref_db.W[30] = 6.0;
    +    SS_ref_db.W[31] = 2.0;
    +    SS_ref_db.W[32] = -11.0;
    +    SS_ref_db.W[33] = 6.0;
    +    SS_ref_db.W[34] = 20.0;
    +    SS_ref_db.W[35] = -11.0;
         
    -    SS_ref_db.v[0] = 1.000;
    -    SS_ref_db.v[1] = 1.000;
    -    SS_ref_db.v[2] = 1.000;
    -    SS_ref_db.v[3] = 1.200;
    -    SS_ref_db.v[4] = 1.000;
    -    SS_ref_db.v[5] = 1.000;
    -    SS_ref_db.v[6] = 1.000;
    -    SS_ref_db.v[7] = 1.000;
    -    SS_ref_db.v[8] = 1.200;
    +    SS_ref_db.v[0] = 1.0;
    +    SS_ref_db.v[1] = 1.0;
    +    SS_ref_db.v[2] = 1.0;
    +    SS_ref_db.v[3] = 1.2;
    +    SS_ref_db.v[4] = 1.0;
    +    SS_ref_db.v[5] = 1.0;
    +    SS_ref_db.v[6] = 1.0;
    +    SS_ref_db.v[7] = 1.0;
    +    SS_ref_db.v[8] = 1.2;
         
         
         em_data en_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"en", 
         										"equilibrium"	);
         
         em_data fs_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"fs", 
         										"equilibrium"	);
         
         em_data di_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"di", 
         										"equilibrium"	);
         
    -    em_data mgts_eq 		= get_em_data(		EM_database, 
    +    em_data mgts_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"mgts", 
         										"equilibrium"	);
         
         em_data kos_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"kos", 
         										"equilibrium"	);
         
         em_data jd_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"jd", 
         										"equilibrium"	);
         
    -    em_data cor_eq 		= get_em_data(		EM_database, 
    +    em_data ru_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"cor", 
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"ru", 
         										"equilibrium"	);
         
    -    em_data ru_eq 		= get_em_data(		EM_database, 
    +    em_data cor_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"ru", 
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"cor", 
         										"equilibrium"	);
         
         em_data per_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"per", 
         										"equilibrium"	);
         
         em_data acm_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"acm", 
         										"equilibrium"	);
         
         SS_ref_db.gbase[0] 		= en_eq.gb;
         SS_ref_db.gbase[1] 		= fs_eq.gb;
    -    SS_ref_db.gbase[2] 		= en_eq.gb/2. + fs_eq.gb/2. - 6.6;
    -    SS_ref_db.gbase[3] 		= 0.005*z_b.P + di_eq.gb + 2.8;
    +    SS_ref_db.gbase[2] 		= 0.5*en_eq.gb + 0.5*fs_eq.gb - 6.6;
    +    SS_ref_db.gbase[3] 		= 0.005*SS_ref_db.P + di_eq.gb + 2.8;
         SS_ref_db.gbase[4] 		= mgts_eq.gb;
    -    SS_ref_db.gbase[5] 		= 0.02*z_b.P + 0.0155*z_b.T - jd_eq.gb + kos_eq.gb + mgts_eq.gb - 28.64;
    -    SS_ref_db.gbase[6] 		= 0.37*z_b.P - 0.0051*z_b.T - cor_eq.gb/2. + mgts_eq.gb + per_eq.gb/2. + ru_eq.gb/2. - 3.91;
    -    SS_ref_db.gbase[7] 		= -0.089*z_b.P + acm_eq.gb - jd_eq.gb + mgts_eq.gb - 0.07;
    -    SS_ref_db.gbase[8] 		= jd_eq.gb + 18.2;
    +    SS_ref_db.gbase[5] 		= 0.05*SS_ref_db.P + 0.0155*SS_ref_db.T - jd_eq.gb + kos_eq.gb + mgts_eq.gb - 25.9;
    +    SS_ref_db.gbase[6] 		= -0.0061*SS_ref_db.P - 0.0051*SS_ref_db.T - 0.5*cor_eq.gb + 0.5*per_eq.gb + mgts_eq.gb + 0.5*ru_eq.gb - 5.0;
    +    SS_ref_db.gbase[7] 		= -0.089*SS_ref_db.P + acm_eq.gb - jd_eq.gb + mgts_eq.gb + 4.8;
    +    SS_ref_db.gbase[8] 		= jd_eq.gb + 18.8;
         
         SS_ref_db.ElShearMod[0] 	= en_eq.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= fs_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[2] 	= en_eq.ElShearMod/2. + fs_eq.ElShearMod/2.;
    +    SS_ref_db.ElShearMod[2] 	= 0.5*en_eq.ElShearMod + 0.5*fs_eq.ElShearMod;
         SS_ref_db.ElShearMod[3] 	= di_eq.ElShearMod;
         SS_ref_db.ElShearMod[4] 	= mgts_eq.ElShearMod;
         SS_ref_db.ElShearMod[5] 	= -jd_eq.ElShearMod + kos_eq.ElShearMod + mgts_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[6] 	= -cor_eq.ElShearMod/2. + mgts_eq.ElShearMod + per_eq.ElShearMod/2. + ru_eq.ElShearMod/2.;
    +    SS_ref_db.ElShearMod[6] 	= -0.5*cor_eq.ElShearMod + 0.5*per_eq.ElShearMod + mgts_eq.ElShearMod + 0.5*ru_eq.ElShearMod;
         SS_ref_db.ElShearMod[7] 	= acm_eq.ElShearMod - jd_eq.ElShearMod + mgts_eq.ElShearMod;
         SS_ref_db.ElShearMod[8] 	= jd_eq.ElShearMod;
         
         for (i = 0; i < len_ox; i++){
             SS_ref_db.Comp[0][i] 	= en_eq.C[i];
             SS_ref_db.Comp[1][i] 	= fs_eq.C[i];
    -        SS_ref_db.Comp[2][i] 	= en_eq.C[i]/2. + fs_eq.C[i]/2.;
    +        SS_ref_db.Comp[2][i] 	= 0.5*en_eq.C[i] + 0.5*fs_eq.C[i];
             SS_ref_db.Comp[3][i] 	= di_eq.C[i];
             SS_ref_db.Comp[4][i] 	= mgts_eq.C[i];
             SS_ref_db.Comp[5][i] 	= -jd_eq.C[i] + kos_eq.C[i] + mgts_eq.C[i];
    -        SS_ref_db.Comp[6][i] 	= -cor_eq.C[i]/2. + mgts_eq.C[i] + per_eq.C[i]/2. + ru_eq.C[i]/2.;
    +        SS_ref_db.Comp[6][i] 	= -0.5*cor_eq.C[i] + 0.5*per_eq.C[i] + mgts_eq.C[i] + 0.5*ru_eq.C[i];
             SS_ref_db.Comp[7][i] 	= acm_eq.C[i] - jd_eq.C[i] + mgts_eq.C[i];
             SS_ref_db.Comp[8][i] 	= jd_eq.C[i];
         }
    @@ -8149,7 +3878,7 @@ 

    Source code for gss_function.c

         SS_ref_db.bounds_ref[5][0] = 0.0+eps;  SS_ref_db.bounds_ref[5][1] = 1.0-eps;
         SS_ref_db.bounds_ref[6][0] = 0.0+eps;  SS_ref_db.bounds_ref[6][1] = 1.0-eps;
         SS_ref_db.bounds_ref[7][0] = 0.0+eps;  SS_ref_db.bounds_ref[7][1] = 1.0-eps;
    -
    +    
     	if (z_b.bulk_rock[9] == 0.){ 					
     		SS_ref_db.z_em[5]          = 0.0;
             SS_ref_db.d_em[5]          = 1.0;
    @@ -8245,98 +3974,89 @@ 

    Source code for gss_function.c

         int i, j;
         int n_em = SS_ref_db.n_em;
         
    -    char   *EM_tmp[] 		= {"nsp","isp","nhc","ihc","nmt","imt","pcr","usp"};
    +    char   *EM_tmp[] 		= {"nsp","isp","nhc","ihc","nmt","imt","pcr","qndm"};
         for (int i = 0; i < SS_ref_db.n_em; i++){
             strcpy(SS_ref_db.EM_list[i],EM_tmp[i]);
         };
         
    -    SS_ref_db.W[0] = -6.700;
    -    SS_ref_db.W[1] = 3.600;
    -    SS_ref_db.W[2] = -9.800;
    -    SS_ref_db.W[3] = 43.20;
    -    SS_ref_db.W[4] = 49.50;
    -    SS_ref_db.W[5] = -0.08*SS_ref_db.P - 38.4;
    -    SS_ref_db.W[6] = 40.00;
    -    SS_ref_db.W[7] = 2.700;
    -    SS_ref_db.W[8] = -3.500;
    -    SS_ref_db.W[9] = 36.80;
    -    SS_ref_db.W[10] = 20.70;
    -    SS_ref_db.W[11] = -0.08*SS_ref_db.P - 21.6;
    -    SS_ref_db.W[12] = 38.20;
    -    SS_ref_db.W[13] = -6.000;
    -    SS_ref_db.W[14] = 17.50;
    -    SS_ref_db.W[15] = 51.60;
    -    SS_ref_db.W[16] = -53.80;
    -    SS_ref_db.W[17] = 25.70;
    -    SS_ref_db.W[18] = -4.100;
    -    SS_ref_db.W[19] = 10.00;
    -    SS_ref_db.W[20] = -38.80;
    -    SS_ref_db.W[21] = 21.00;
    -    SS_ref_db.W[22] = 18.10;
    -    SS_ref_db.W[23] = 12.10;
    -    SS_ref_db.W[24] = 5.200;
    -    SS_ref_db.W[25] = -8.700;
    -    SS_ref_db.W[26] = 21.50;
    -    SS_ref_db.W[27] = 15.00;
    -    
    -    SS_ref_db.v[0] = 1.000;
    -    SS_ref_db.v[1] = 1.000;
    -    SS_ref_db.v[2] = 1.000;
    -    SS_ref_db.v[3] = 1.000;
    -    SS_ref_db.v[4] = 1.000;
    -    SS_ref_db.v[5] = 1.000;
    -    SS_ref_db.v[6] = 1.000;
    -    SS_ref_db.v[7] = 0.9000;
    +    SS_ref_db.W[0] = -8.2;
    +    SS_ref_db.W[1] = 3.5;
    +    SS_ref_db.W[2] = -13.0;
    +    SS_ref_db.W[3] = 43.2;
    +    SS_ref_db.W[4] = 49.1;
    +    SS_ref_db.W[5] = -5.0;
    +    SS_ref_db.W[6] = 22.5;
    +    SS_ref_db.W[7] = 4.4;
    +    SS_ref_db.W[8] = -6.0;
    +    SS_ref_db.W[9] = 36.8;
    +    SS_ref_db.W[10] = 20.0;
    +    SS_ref_db.W[11] = 14.0;
    +    SS_ref_db.W[12] = 21.5;
    +    SS_ref_db.W[13] = -8.2;
    +    SS_ref_db.W[14] = 18.1;
    +    SS_ref_db.W[15] = 49.0;
    +    SS_ref_db.W[16] = -19.0;
    +    SS_ref_db.W[17] = 35.1;
    +    SS_ref_db.W[18] = -4.0;
    +    SS_ref_db.W[19] = 7.6;
    +    SS_ref_db.W[20] = -11.0;
    +    SS_ref_db.W[21] = 9.0;
    +    SS_ref_db.W[22] = 18.1;
    +    SS_ref_db.W[23] = 11.9;
    +    SS_ref_db.W[24] = 62.2;
    +    SS_ref_db.W[25] = -6.4;
    +    SS_ref_db.W[26] = 24.3;
    +    SS_ref_db.W[27] = 60.0;
         
         
         em_data sp_or 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"sp", 
         										"ordered"	);
         
    -    em_data herc_or 		= get_em_data(		EM_database, 
    +    em_data herc_or 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"herc", 
         										"ordered"	);
         
         em_data mt_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"mt", 
         										"equilibrium"	);
         
    -    em_data picr_eq 		= get_em_data(		EM_database, 
    +    em_data picr_eq 	= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    +											SS_ref_db.P,
    +											SS_ref_db.T,
         										"picr", 
         										"equilibrium"	);
         
    -    em_data usp_eq 		= get_em_data(		EM_database, 
    +    em_data qnd_eq 		= get_em_data(		EM_database, 
         										len_ox,
         										z_b,
    -    										SS_ref_db.P,
    -    										SS_ref_db.T,
    -    										"usp", 
    +											SS_ref_db.P,
    +											SS_ref_db.T,
    +    										"qnd", 
         										"equilibrium"	);
         
         SS_ref_db.gbase[0] 		= sp_or.gb;
    -    SS_ref_db.gbase[1] 		= -0.005763*z_b.T + sp_or.gb + 23.5;
    +    SS_ref_db.gbase[1] 		= -0.005763*SS_ref_db.T + sp_or.gb + 23.6;
         SS_ref_db.gbase[2] 		= herc_or.gb;
    -    SS_ref_db.gbase[3] 		= -0.005763*z_b.T + herc_or.gb + 23.6;
    -    SS_ref_db.gbase[4] 		= 0.005763*z_b.T + mt_eq.gb;
    +    SS_ref_db.gbase[3] 		= -0.005763*SS_ref_db.T + herc_or.gb + 23.6;
    +    SS_ref_db.gbase[4] 		= 0.005763*SS_ref_db.T + mt_eq.gb;
         SS_ref_db.gbase[5] 		= mt_eq.gb + 0.3;
         SS_ref_db.gbase[6] 		= picr_eq.gb;
    -    SS_ref_db.gbase[7] 		= usp_eq.gb;
    +    SS_ref_db.gbase[7] 		= qnd_eq.gb - 30.0;
         
         SS_ref_db.ElShearMod[0] 	= sp_or.ElShearMod;
         SS_ref_db.ElShearMod[1] 	= sp_or.ElShearMod;
    @@ -8345,7 +4065,7 @@ 

    Source code for gss_function.c

         SS_ref_db.ElShearMod[4] 	= mt_eq.ElShearMod;
         SS_ref_db.ElShearMod[5] 	= mt_eq.ElShearMod;
         SS_ref_db.ElShearMod[6] 	= picr_eq.ElShearMod;
    -    SS_ref_db.ElShearMod[7] 	= usp_eq.ElShearMod;
    +    SS_ref_db.ElShearMod[7] 	= qnd_eq.ElShearMod;
         
         for (i = 0; i < len_ox; i++){
             SS_ref_db.Comp[0][i] 	= sp_or.C[i];
    @@ -8355,7 +4075,7 @@ 

    Source code for gss_function.c

             SS_ref_db.Comp[4][i] 	= mt_eq.C[i];
             SS_ref_db.Comp[5][i] 	= mt_eq.C[i];
             SS_ref_db.Comp[6][i] 	= picr_eq.C[i];
    -        SS_ref_db.Comp[7][i] 	= usp_eq.C[i];
    +        SS_ref_db.Comp[7][i] 	= qnd_eq.C[i];
         }
         
         for (i = 0; i < n_em; i++){
    @@ -8369,7 +4089,7 @@ 

    Source code for gss_function.c

         SS_ref_db.bounds_ref[4][0] = -1.0+eps;  SS_ref_db.bounds_ref[4][1] = 1.0-eps;
         SS_ref_db.bounds_ref[5][0] = -1.0+eps;  SS_ref_db.bounds_ref[5][1] = 1.0-eps;
         SS_ref_db.bounds_ref[6][0] = -1.0+eps;  SS_ref_db.bounds_ref[6][1] = 1.0-eps;
    -
    +    
     	if (z_b.bulk_rock[9] == 0.){ 
     		SS_ref_db.z_em[6]          = 0.0;
     		SS_ref_db.d_em[6]          = 1.0;
    @@ -9330,149 +5050,6 @@ 

    Source code for gss_function.c

     					   
     	SS_ref_db.ss_flags[0]  = 1;
     
    -	/* Associate the right solid-solution data */
    -	for (int FD = 0; FD < gv.n_Diff; FD++){				/* cycle twice in order to get gb_P_eps to calculate densities later on */
    -		
    -		if (FD == 8 || FD == 9){				// dG/dP0 to get Volume at P = 1bar
    -			SS_ref_db.P = 1.+ gv.gb_P_eps*gv.pdev[0][FD];
    -			SS_ref_db.T = T + gv.gb_T_eps*gv.pdev[1][FD];
    -		}
    -		else{
    -			SS_ref_db.P = P + gv.gb_P_eps*gv.pdev[0][FD];
    -			SS_ref_db.T = T + gv.gb_T_eps*gv.pdev[1][FD];
    -		}
    -
    -		if (strcmp( name, "bi") == 0 ){
    -			// if no H2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_bi_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "cd") == 0){
    -			// if no H2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_cd_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "cpx") == 0){
    -			SS_ref_db  = G_SS_ig_cpx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}	
    -		else if (strcmp( name, "ep") == 0){
    -			// if no h2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_ep_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "fl") == 0){
    -			// if no H2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_fl_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}		
    -		else if (strcmp( name, "g") == 0){
    -			SS_ref_db  = G_SS_ig_g_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);		}
    -		else if (strcmp( name, "hb") == 0){
    -			// if no H2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_hb_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}	
    -		else if (strcmp( name, "ilm") == 0){
    -			// if no TiO2, deactivate
    -			if (z_b.bulk_rock[7] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_ilm_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "liq") == 0){
    -			/* turn of liquid when T < 600°C) */
    -			if ( T < gv.min_melt_T){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db = G_SS_ig_liq_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "mu") == 0){
    -			// if no H2O, deactivate
    -			if (z_b.bulk_rock[gv.H2O_id] == 0.){
    -				SS_ref_db.ss_flags[0]  = 0;
    -			}
    -			SS_ref_db  = G_SS_ig_mu_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}	
    -		else if (strcmp( name, "ol") == 0){
    -			SS_ref_db  = G_SS_ig_ol_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "opx") == 0){
    -			SS_ref_db  = G_SS_ig_opx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else if (strcmp( name, "pl4T") == 0){
    -			SS_ref_db  = G_SS_ig_pl4T_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}	
    -		else if (strcmp( name, "spn") == 0){
    -			SS_ref_db  = G_SS_ig_spn_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    -		else{
    -			printf("\nsolid solution '%s' is not in the database\n",name);	}	
    -		
    -		for (int j = 0; j < SS_ref_db.n_em; j++){
    -			SS_ref_db.mu_array[FD][j] = SS_ref_db.gbase[j];
    -			// printf(" %+10.10f",SS_ref_db.gbase[j]);
    -		}
    -		// printf("\n");
    -	}
    -
    -	for (int j = 0; j < SS_ref_db.n_xeos; j++){
    -		SS_ref_db.bounds[j][0] = SS_ref_db.bounds_ref[j][0];
    -		SS_ref_db.bounds[j][1] = SS_ref_db.bounds_ref[j][1];
    -	}
    -
    -	/* Calculate the number of atoms in the bulk-rock composition */
    -	double fbc     = 0.0;
    -	for (int i = 0; i < gv.len_ox; i++){
    -		fbc += z_b.bulk_rock[i]*z_b.apo[i];
    -	}
    -
    -	/* get the numer of atoms per endmember, needed to update normalization factor for liquid */
    -	for (int i = 0; i < SS_ref_db.n_em; i++){
    -		SS_ref_db.ape[i] = 0.0;
    -		for (int j = 0; j < gv.len_ox; j++){
    -			SS_ref_db.ape[i] += SS_ref_db.Comp[i][j]*z_b.apo[j];
    -		}
    -	}
    -	
    -	SS_ref_db.fbc = z_b.fbc;	
    -	
    -	if (gv.verbose == 1){
    -		printf(" %4s:",name);
    -
    -		/* display Gibbs free energy of reference? */
    -		for (int j = 0; j < SS_ref_db.n_em; j++){
    -			printf(" %+12.5f",SS_ref_db.gbase[j]);
    -		}
    -		printf("\n");
    -
    -		if (1 == 1){
    -			/* display molar composition */
    -            printf("\n S   A   C   M   F   K   N   T   O   Cr  H\n");
    -			for (int i = 0; i < SS_ref_db.n_em; i++){
    -				for (int j = 0; j < gv.len_ox; j++){
    -					printf(" %.1f",SS_ref_db.Comp[i][j]);
    -				}
    -				printf("\n");
    -			}
    -			printf("\n");
    -		}
    -	}
    -
    -	return SS_ref_db;
    -};
    - -
    [docs]/** - checks if it can satisfy the mass constraint -*/ -SS_ref G_SS_igd_EM_function( global_variable gv, - SS_ref SS_ref_db, - int EM_database, - bulk_info z_b, - char *name ){ - - double eps = gv.bnd_val; - double P = SS_ref_db.P; - double T = SS_ref_db.T; - - SS_ref_db.ss_flags[0] = 1; - /* Associate the right solid-solution data */ for (int FD = 0; FD < gv.n_Diff; FD++){ /* cycle twice in order to get gb_P_eps to calculate densities later on */ if (FD == 8 || FD == 9){ // dG/dP0 to get Volume at P = 1bar @@ -9484,50 +5061,52 @@

    Source code for gss_function.c

                 SS_ref_db.T = T + gv.gb_T_eps*gv.pdev[1][FD];
             }
             if (strcmp( name, "liq") == 0 ){
    -            SS_ref_db  = G_SS_igd_liq_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_liq_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			if ( T < gv.min_melt_T){
     				SS_ref_db.ss_flags[0]  = 0;
     			}}
             else if (strcmp( name, "fl") == 0 ){
    -            SS_ref_db  = G_SS_igd_fl_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_fl_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			// if no H2O, deactivate
     			if (z_b.bulk_rock[gv.H2O_id] == 0.){
     				SS_ref_db.ss_flags[0]  = 0;
     			}}
    -        else if (strcmp( name, "fsp") == 0 ){
    -            SS_ref_db  = G_SS_igd_fsp_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +        else if (strcmp( name, "pl4T") == 0 ){
    +            SS_ref_db  = G_SS_ig_pl4T_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);}
    +        else if (strcmp( name, "fper") == 0 ){
    +            SS_ref_db  = G_SS_ig_fper_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "spn") == 0 ){
    -            SS_ref_db  = G_SS_igd_spn_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_spn_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "g") == 0 ){
    -            SS_ref_db  = G_SS_igd_g_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_g_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "ol") == 0 ){
    -            SS_ref_db  = G_SS_igd_ol_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_ol_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "opx") == 0 ){
    -            SS_ref_db  = G_SS_igd_opx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_opx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "cpx") == 0 ){
    -            SS_ref_db  = G_SS_igd_cpx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_cpx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "ilm") == 0 ){
    -            SS_ref_db  = G_SS_igd_ilm_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
    +            SS_ref_db  = G_SS_ig_ilm_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	}
             else if (strcmp( name, "hb") == 0 ){
    -            SS_ref_db  = G_SS_igd_hb_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_hb_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			// if no H2O, deactivate
     			if (z_b.bulk_rock[gv.H2O_id] == 0.){
     				SS_ref_db.ss_flags[0]  = 0;
     			}}
             else if (strcmp( name, "bi") == 0 ){
    -            SS_ref_db  = G_SS_igd_bi_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_bi_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			// if no H2O, deactivate
     			if (z_b.bulk_rock[gv.H2O_id] == 0.){
     				SS_ref_db.ss_flags[0]  = 0;
     			}}
             else if (strcmp( name, "ep") == 0 ){
    -            SS_ref_db  = G_SS_igd_ep_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_ep_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			// if no H2O, deactivate
     			if (z_b.bulk_rock[gv.H2O_id] == 0.){
     				SS_ref_db.ss_flags[0]  = 0;
     			}}
             else if (strcmp( name, "cd") == 0 ){
    -            SS_ref_db  = G_SS_igd_cd_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
    +            SS_ref_db  = G_SS_ig_cd_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps);	
     			// if no H2O, deactivate
     			if (z_b.bulk_rock[gv.H2O_id] == 0.){
     				SS_ref_db.ss_flags[0]  = 0;
    @@ -9588,142 +5167,6 @@ 

    Source code for gss_function.c

     };
    - -
    [docs]/** - checks if it can satisfy the mass constraint -*/ -SS_ref G_SS_alk_EM_function( global_variable gv, - SS_ref SS_ref_db, - int EM_database, - bulk_info z_b, - char *name ){ - - double eps = gv.bnd_val; - double P = SS_ref_db.P; - double T = SS_ref_db.T; - - SS_ref_db.ss_flags[0] = 1; - - /* Associate the right solid-solution data */ - for (int FD = 0; FD < gv.n_Diff; FD++){ /* cycle twice in order to get gb_P_eps to calculate densities later on */ - if (FD == 8 || FD == 9){ // dG/dP0 to get Volume at P = 1bar - SS_ref_db.P = 1.+ gv.gb_P_eps*gv.pdev[0][FD]; - SS_ref_db.T = T + gv.gb_T_eps*gv.pdev[1][FD]; - } - else{ - SS_ref_db.P = P + gv.gb_P_eps*gv.pdev[0][FD]; - SS_ref_db.T = T + gv.gb_T_eps*gv.pdev[1][FD]; - } - if (strcmp( name, "liq") == 0 ){ - SS_ref_db = G_SS_alk_liq_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "fl") == 0 ){ - SS_ref_db = G_SS_alk_fl_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - // if no H2O, deactivate - if (z_b.bulk_rock[gv.H2O_id] == 0.){ - SS_ref_db.ss_flags[0] = 0; - }} - else if (strcmp( name, "fsp") == 0 ){ - SS_ref_db = G_SS_alk_fsp_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "spn") == 0 ){ - SS_ref_db = G_SS_alk_spn_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "g") == 0 ){ - SS_ref_db = G_SS_alk_g_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "ol") == 0 ){ - SS_ref_db = G_SS_alk_ol_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "opx") == 0 ){ - SS_ref_db = G_SS_alk_opx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - if (gv.limitCaOpx == 1){ SS_ref_db.bounds_ref[2][1] = 0.5-eps; }} /* add-hoc correction to limit the stability of Ca-rich orthopyroxene */ - else if (strcmp( name, "cpx") == 0 ){ - SS_ref_db = G_SS_alk_cpx_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "ilm") == 0 ){ - SS_ref_db = G_SS_alk_ilm_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "ness") == 0 ){ - SS_ref_db = G_SS_alk_ness_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "lct") == 0 ){ - SS_ref_db = G_SS_alk_lct_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "kals") == 0 ){ - SS_ref_db = G_SS_alk_kals_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "mel") == 0 ){ - SS_ref_db = G_SS_alk_mel_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); } - else if (strcmp( name, "hb") == 0 ){ - SS_ref_db = G_SS_alk_hb_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - // if no H2O, deactivate - if (z_b.bulk_rock[gv.H2O_id] == 0.){ - SS_ref_db.ss_flags[0] = 0; - }} - else if (strcmp( name, "bi") == 0 ){ - SS_ref_db = G_SS_alk_bi_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - // if no H2O, deactivate - if (z_b.bulk_rock[gv.H2O_id] == 0.){ - SS_ref_db.ss_flags[0] = 0; - }} - else if (strcmp( name, "ep") == 0 ){ - SS_ref_db = G_SS_alk_ep_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - // if no H2O, deactivate - if (z_b.bulk_rock[gv.H2O_id] == 0.){ - SS_ref_db.ss_flags[0] = 0; - }} - else if (strcmp( name, "cd") == 0 ){ - SS_ref_db = G_SS_alk_cd_function(SS_ref_db, EM_database, gv.len_ox, z_b, eps); - // if no H2O, deactivate - if (z_b.bulk_rock[gv.H2O_id] == 0.){ - SS_ref_db.ss_flags[0] = 0; - }} - else{ - printf("\nsolid solution '%s' is not in the database\n",name); } - - for (int j = 0; j < SS_ref_db.n_em; j++){ - SS_ref_db.mu_array[FD][j] = SS_ref_db.gbase[j]; - // printf(" %+10.10f",SS_ref_db.gbase[j]); - } - } - - for (int j = 0; j < SS_ref_db.n_xeos; j++){ - SS_ref_db.bounds[j][0] = SS_ref_db.bounds_ref[j][0]; - SS_ref_db.bounds[j][1] = SS_ref_db.bounds_ref[j][1]; - } - - /* Calculate the number of atoms in the bulk-rock composition */ - double fbc = 0.0; - for (int i = 0; i < gv.len_ox; i++){ - fbc += z_b.bulk_rock[i]*z_b.apo[i]; - } - - /* get the numer of atoms per endmember, needed to update normalization factor for liquid */ - for (int i = 0; i < SS_ref_db.n_em; i++){ - SS_ref_db.ape[i] = 0.0; - for (int j = 0; j < gv.len_ox; j++){ - SS_ref_db.ape[i] += SS_ref_db.Comp[i][j]*z_b.apo[j]; - } - } - - SS_ref_db.fbc = z_b.fbc; - - if (gv.verbose == 1){ - printf(" %4s:",name); - - /* display Gibbs free energy of reference? */ - for (int j = 0; j < SS_ref_db.n_em; j++){ - printf(" %+12.5f",SS_ref_db.gbase[j]); - } - printf("\n"); - - if (1 == 1){ - /* display molar composition */ - printf("\n S A C M F K N T O Cr H \n"); - for (int i = 0; i < SS_ref_db.n_em; i++){ - for (int j = 0; j < gv.len_ox; j++){ - printf(" %.1f",SS_ref_db.Comp[i][j]); - } - printf("\n"); - } - printf("\n"); - } - } - - return SS_ref_db; -};
    -
    [docs]/** checks if it can satisfy the mass constraint */ diff --git a/docs/_modules/gss_init_function.c.html b/docs/_modules/gss_init_function.c.html index e317ce29..77a34067 100644 --- a/docs/_modules/gss_init_function.c.html +++ b/docs/_modules/gss_init_function.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -395,518 +404,6 @@

    Source code for gss_init_function.c

     
     
     
    -/**************************************************************************************/
    -/**************************************************************************************/
    -/*******************IGNEOUS ALKALINE DATABASE (Weller et al., 2023)********************/
    -/**************************************************************************************/
    -/**************************************************************************************/
    -
    -
    [docs]/** - allocate memory for liq -*/ -SS_ref G_SS_alk_liq_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 1; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 21; - SS_ref_db.n_em = 15; - SS_ref_db.n_v = 15; - SS_ref_db.n_w = 105; - SS_ref_db.n_xeos = 14; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for fl -*/ -SS_ref G_SS_alk_fl_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 4; - SS_ref_db.n_w = 6; - SS_ref_db.n_xeos = 3; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for fsp -*/ -SS_ref G_SS_alk_fsp_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 3; - SS_ref_db.n_v = 3; - SS_ref_db.n_w = 3; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for spn -*/ -SS_ref G_SS_alk_spn_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 10; - SS_ref_db.n_em = 8; - SS_ref_db.n_v = 8; - SS_ref_db.n_w = 28; - SS_ref_db.n_xeos = 7; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for g -*/ -SS_ref G_SS_alk_g_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 8; - SS_ref_db.n_em = 6; - SS_ref_db.n_v = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ol -*/ -SS_ref G_SS_alk_ol_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 4; - SS_ref_db.n_w = 6; - SS_ref_db.n_xeos = 3; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for opx -*/ -SS_ref G_SS_alk_opx_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 12; - SS_ref_db.n_em = 9; - SS_ref_db.n_v = 9; - SS_ref_db.n_w = 36; - SS_ref_db.n_xeos = 8; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for cpx -*/ -SS_ref G_SS_alk_cpx_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 13; - SS_ref_db.n_em = 10; - SS_ref_db.n_v = 10; - SS_ref_db.n_w = 45; - SS_ref_db.n_xeos = 9; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ilm -*/ -SS_ref G_SS_alk_ilm_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 8; - SS_ref_db.n_em = 5; - SS_ref_db.n_w = 10; - SS_ref_db.n_xeos = 4; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ness -*/ -SS_ref G_SS_alk_ness_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 9; - SS_ref_db.n_em = 6; - SS_ref_db.n_v = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for lct -*/ -SS_ref G_SS_alk_lct_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 2; - SS_ref_db.n_em = 2; - SS_ref_db.n_v = 2; - SS_ref_db.n_w = 1; - SS_ref_db.n_xeos = 1; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for kals -*/ -SS_ref G_SS_alk_kals_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 2; - SS_ref_db.n_em = 2; - SS_ref_db.n_v = 2; - SS_ref_db.n_w = 1; - SS_ref_db.n_xeos = 1; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for mel -*/ -SS_ref G_SS_alk_mel_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 8; - SS_ref_db.n_em = 5; - SS_ref_db.n_w = 10; - SS_ref_db.n_xeos = 4; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for hb -*/ -SS_ref G_SS_alk_hb_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 18; - SS_ref_db.n_em = 11; - SS_ref_db.n_v = 11; - SS_ref_db.n_w = 55; - SS_ref_db.n_xeos = 10; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for bi -*/ -SS_ref G_SS_alk_bi_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 11; - SS_ref_db.n_em = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ep -*/ -SS_ref G_SS_alk_ep_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 4; - SS_ref_db.n_em = 3; - SS_ref_db.n_w = 3; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for cd -*/ -SS_ref G_SS_alk_cd_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 4; - SS_ref_db.n_em = 3; - SS_ref_db.n_w = 2; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - - -/**************************************************************************************/ -/**************************************************************************************/ -/*********************IGNEOUS DRY DATABASE (Green et al., 2023)************************/ -/**************************************************************************************/ -/**************************************************************************************/ - -
    [docs]/** - allocate memory for liq -*/ -SS_ref G_SS_igd_liq_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 1; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 21; - SS_ref_db.n_em = 15; - SS_ref_db.n_v = 15; - SS_ref_db.n_w = 105; - SS_ref_db.n_xeos = 14; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for fl -*/ -SS_ref G_SS_igd_fl_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 4; - SS_ref_db.n_w = 6; - SS_ref_db.n_xeos = 3; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for fsp -*/ -SS_ref G_SS_igd_fsp_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 3; - SS_ref_db.n_v = 3; - SS_ref_db.n_w = 3; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for spn -*/ -SS_ref G_SS_igd_spn_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 10; - SS_ref_db.n_em = 8; - SS_ref_db.n_v = 8; - SS_ref_db.n_w = 28; - SS_ref_db.n_xeos = 7; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for g -*/ -SS_ref G_SS_igd_g_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 8; - SS_ref_db.n_em = 6; - SS_ref_db.n_v = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ol -*/ -SS_ref G_SS_igd_ol_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 5; - SS_ref_db.n_em = 4; - SS_ref_db.n_w = 6; - SS_ref_db.n_xeos = 3; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for opx -*/ -SS_ref G_SS_igd_opx_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 12; - SS_ref_db.n_em = 9; - SS_ref_db.n_v = 9; - SS_ref_db.n_w = 36; - SS_ref_db.n_xeos = 8; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for cpx -*/ -SS_ref G_SS_igd_cpx_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 13; - SS_ref_db.n_em = 10; - SS_ref_db.n_v = 10; - SS_ref_db.n_w = 45; - SS_ref_db.n_xeos = 9; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ilm -*/ -SS_ref G_SS_igd_ilm_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 8; - SS_ref_db.n_em = 5; - SS_ref_db.n_w = 10; - SS_ref_db.n_xeos = 4; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for hb -*/ -SS_ref G_SS_igd_hb_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 18; - SS_ref_db.n_em = 11; - SS_ref_db.n_v = 11; - SS_ref_db.n_w = 55; - SS_ref_db.n_xeos = 10; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for bi -*/ -SS_ref G_SS_igd_bi_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 11; - SS_ref_db.n_em = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for ep -*/ -SS_ref G_SS_igd_ep_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 4; - SS_ref_db.n_em = 3; - SS_ref_db.n_w = 3; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - -
    [docs]/** - allocate memory for cd -*/ -SS_ref G_SS_igd_cd_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 1; - SS_ref_db.n_sf = 4; - SS_ref_db.n_em = 3; - SS_ref_db.n_w = 2; - SS_ref_db.n_xeos = 2; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    - - - /**************************************************************************************/ /**************************************************************************************/ @@ -1178,11 +675,26 @@

    Source code for gss_init_function.c

     
     
     
    -/**************************************************************************************/
    +
    [docs]/**************************************************************************************/ /**************************************************************************************/ /*********************IGNEOUS DATABASE (Holland et al., 2018)**************************/ /**************************************************************************************/ /**************************************************************************************/ +/** + allocate memory for fper +*/ +SS_ref G_SS_ig_fper_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ + + SS_ref_db.is_liq = 0; + SS_ref_db.symmetry = 1; + SS_ref_db.n_sf = 2; + SS_ref_db.n_em = 2; + SS_ref_db.n_w = 1; + SS_ref_db.n_xeos = 1; + SS_ref_db.CstFactor = 0; + + return SS_ref_db; +}
    [docs]/** allocate memory for biotite @@ -1306,13 +818,13 @@

    Source code for gss_init_function.c

     */
     SS_ref G_SS_ig_ilm_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){
         
    -    SS_ref_db.is_liq    = 0;
    -    SS_ref_db.symmetry  = 1;
    -    SS_ref_db.n_sf      = 8;
    -    SS_ref_db.n_em      = 5;
    -    SS_ref_db.n_w       = 10;
    -    SS_ref_db.n_xeos    = 4;
    -    SS_ref_db.CstFactor = 0;
    +	SS_ref_db.is_liq    = 0;	
    +	SS_ref_db.symmetry  = 1;							  					  
    +	SS_ref_db.n_sf      = 6;
    +	SS_ref_db.n_em      = 3;
    +	SS_ref_db.n_w       = 3;
    +	SS_ref_db.n_xeos    = 2; 
    +	SS_ref_db.CstFactor = 0;
         
         return SS_ref_db;
     }
    @@ -1335,23 +847,6 @@

    Source code for gss_init_function.c

         return SS_ref_db;
     }
    -
    [docs]/** - allocate memory for muscovite -*/ -SS_ref G_SS_ig_mu_init_function(SS_ref SS_ref_db, int EM_database, global_variable gv){ - - SS_ref_db.is_liq = 0; - SS_ref_db.symmetry = 0; - SS_ref_db.n_sf = 10; - SS_ref_db.n_em = 6; - SS_ref_db.n_v = 6; - SS_ref_db.n_w = 15; - SS_ref_db.n_xeos = 5; - SS_ref_db.CstFactor = 0; - - return SS_ref_db; -}
    -
    [docs]/** allocate memory for olivine */ @@ -1666,108 +1161,38 @@

    Source code for gss_init_function.c

     		}	
     	}							  
     	else if (EM_database == 2) {	 //"bi","cd","cpx","ep","fl","g","hb","ilm","liq","mu","ol","opx","pl4T","spn"	
    -		if      (strcmp( name, "bi")  == 0 ){
    -			SS_ref_db  = G_SS_ig_bi_init_function(SS_ref_db, EM_database, gv); 		}
    -		else if (strcmp( name, "cd")  == 0){
    -			SS_ref_db  = G_SS_ig_cd_init_function(SS_ref_db, EM_database, gv); 		}
    -		else if (strcmp( name, "cpx") == 0){
    -			SS_ref_db  = G_SS_ig_cpx_init_function(SS_ref_db, EM_database, gv); 	}	
    -		else if (strcmp( name, "ep")  == 0){
    -			SS_ref_db  = G_SS_ig_ep_init_function(SS_ref_db, EM_database, gv); 		}
    -		else if (strcmp( name, "fl")  == 0){
    -			SS_ref_db  = G_SS_ig_fl_init_function(SS_ref_db, EM_database, gv); 		}		
    -		else if (strcmp( name, "g")   == 0){
    -			SS_ref_db  = G_SS_ig_g_init_function(SS_ref_db, EM_database, gv); 		}
    -		else if (strcmp( name, "hb")  == 0){
    -			SS_ref_db  = G_SS_ig_hb_init_function(SS_ref_db, EM_database, gv); 		}	
    -		else if (strcmp( name, "ilm") == 0){
    -			SS_ref_db  = G_SS_ig_ilm_init_function(SS_ref_db, EM_database, gv); 	}
    -		else if (strcmp( name, "liq") == 0){
    -			SS_ref_db  = G_SS_ig_liq_init_function(SS_ref_db, EM_database, gv); 	}
    -		else if (strcmp( name, "mu")  == 0){
    -			SS_ref_db  = G_SS_ig_mu_init_function(SS_ref_db, EM_database, gv); 		}	
    -		else if (strcmp( name, "ol")  == 0){
    -			SS_ref_db  = G_SS_ig_ol_init_function(SS_ref_db, EM_database, gv); 		}
    -		else if (strcmp( name, "opx") == 0){
    -			SS_ref_db  = G_SS_ig_opx_init_function(SS_ref_db, EM_database, gv); 	}
    -		else if (strcmp( name, "pl4T") == 0){
    -			SS_ref_db  = G_SS_ig_pl4T_init_function(SS_ref_db, EM_database, gv); 	}	
    -		else if (strcmp( name, "spn") == 0){
    -			SS_ref_db  = G_SS_ig_spn_init_function(SS_ref_db, EM_database, gv); 	}
    -		else{
    -			printf("\nsolid solution '%s' is not in the database, cannot be initiated\n", name);	
    -		}	
    -	}
    -	else if (EM_database == 3){
     		if (strcmp( name, "liq") == 0 ){
    -			SS_ref_db  = G_SS_igd_liq_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_liq_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "fl") == 0 ){
    -			SS_ref_db  = G_SS_igd_fl_init_function(SS_ref_db, EM_database, gv); }
    -		else if (strcmp( name, "fsp") == 0 ){
    -			SS_ref_db  = G_SS_igd_fsp_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_fl_init_function(SS_ref_db, EM_database, gv); }
    +		else if (strcmp( name, "pl4T") == 0 ){
    +			SS_ref_db  = G_SS_ig_pl4T_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "spn") == 0 ){
    -			SS_ref_db  = G_SS_igd_spn_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_spn_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "g") == 0 ){
    -			SS_ref_db  = G_SS_igd_g_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_g_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "ol") == 0 ){
    -			SS_ref_db  = G_SS_igd_ol_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_ol_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "opx") == 0 ){
    -			SS_ref_db  = G_SS_igd_opx_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_opx_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "cpx") == 0 ){
    -			SS_ref_db  = G_SS_igd_cpx_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_cpx_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "ilm") == 0 ){
    -			SS_ref_db  = G_SS_igd_ilm_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_ilm_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "hb") == 0 ){
    -			SS_ref_db  = G_SS_igd_hb_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_hb_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "bi") == 0 ){
    -			SS_ref_db  = G_SS_igd_bi_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_bi_init_function(SS_ref_db, EM_database, gv); }
    +		else if (strcmp( name, "fper") == 0 ){
    +			SS_ref_db  = G_SS_ig_fper_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "ep") == 0 ){
    -			SS_ref_db  = G_SS_igd_ep_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_ep_init_function(SS_ref_db, EM_database, gv); }
     		else if (strcmp( name, "cd") == 0 ){
    -			SS_ref_db  = G_SS_igd_cd_init_function(SS_ref_db, EM_database, gv); }
    +			SS_ref_db  = G_SS_ig_cd_init_function(SS_ref_db, EM_database, gv); }
     		else{
     			printf("\nsolid solution '%s' is not in the database, cannot be initiated\n", name);	
     		}	
     	}
    -    else if (EM_database == 6){
    -        if (strcmp( name, "liq") == 0 ){
    -            SS_ref_db  = G_SS_alk_liq_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "fl") == 0 ){
    -            SS_ref_db  = G_SS_alk_fl_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "fsp") == 0 ){
    -            SS_ref_db  = G_SS_alk_fsp_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "spn") == 0 ){
    -            SS_ref_db  = G_SS_alk_spn_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "g") == 0 ){
    -            SS_ref_db  = G_SS_alk_g_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "ol") == 0 ){
    -            SS_ref_db  = G_SS_alk_ol_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "opx") == 0 ){
    -            SS_ref_db  = G_SS_alk_opx_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "cpx") == 0 ){
    -            SS_ref_db  = G_SS_alk_cpx_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "ilm") == 0 ){
    -            SS_ref_db  = G_SS_alk_ilm_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "ness") == 0 ){
    -            SS_ref_db  = G_SS_alk_ness_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "lct") == 0 ){
    -            SS_ref_db  = G_SS_alk_lct_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "kals") == 0 ){
    -            SS_ref_db  = G_SS_alk_kals_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "mel") == 0 ){
    -            SS_ref_db  = G_SS_alk_mel_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "hb") == 0 ){
    -            SS_ref_db  = G_SS_alk_hb_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "bi") == 0 ){
    -            SS_ref_db  = G_SS_alk_bi_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "ep") == 0 ){
    -            SS_ref_db  = G_SS_alk_ep_init_function(SS_ref_db, EM_database, gv); }
    -        else if (strcmp( name, "cd") == 0 ){
    -            SS_ref_db  = G_SS_alk_cd_init_function(SS_ref_db, EM_database, gv); }
    -        else{
    -            printf("\nsolid solution '%s' is not in the database\n",name);
    -        }
    -    }
     	else if (EM_database == 4) {
     		if      (strcmp( name, "fluid")  == 0 ){
     			SS_ref_db  = G_SS_um_fluid_init_function(SS_ref_db, EM_database, gv); 	}
    diff --git a/docs/_modules/io_function.c.html b/docs/_modules/io_function.c.html
    index d5e035ee..072f280c 100644
    --- a/docs/_modules/io_function.c.html
    +++ b/docs/_modules/io_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/_modules/objective_functions.c.html b/docs/_modules/objective_functions.c.html index b48364c7..c1c8e16f 100644 --- a/docs/_modules/objective_functions.c.html +++ b/docs/_modules/objective_functions.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -1631,4246 +1640,167 @@

    Source code for objective_functions.c

     }
    +
    [docs]/**************************************************************************************/ /**************************************************************************************/ -/**************************************************************************************/ -/********************IGNEOUS ALKALINE DATABASE (Weller et al., 2023)*******************/ +/*********************METAPELITE DATABASE (White et al., 2014)*************************/ /**************************************************************************************/ /**************************************************************************************/ - - -
    [docs]/** - Endmember to xeos for ness +/** + Update dpdx matrix of liq_mp */ -void p2x_alk_ness(void *SS_ref_db, double eps){ +void dpdx_mp_liq(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[3] = d->p[5]; - d->iguess[4] = 0.333333333333333*d->p[4]; - d->iguess[2] = d->p[3]; - d->iguess[0] = 3.0*d->iguess[4] + d->p[1]; - d->iguess[1] = (4.0*d->iguess[3] + 4.0*d->p[0] + 3.0*d->iguess[2] + 4.0*d->iguess[0] - 4.0)/(3.0*d->iguess[4] + d->iguess[0] - 4.0); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = 1.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = 0.0; dp_dx[0][3] = 0.0; dp_dx[0][4] = 0.0; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; + dp_dx[1][0] = 0.0; dp_dx[1][1] = x[2]; dp_dx[1][2] = x[1]; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; + dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0 - x[2]; dp_dx[2][2] = -x[1]; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; + dp_dx[4][0] = -1.0; dp_dx[4][1] = -1.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = -1.0; dp_dx[4][4] = -1.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = -1.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 1.0 - x[5]; dp_dx[5][5] = -x[4]; dp_dx[5][6] = 0.0; + dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = x[5]; dp_dx[6][5] = x[4]; dp_dx[6][6] = 0.0; + dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 1.0; }
    -
    [docs]/** - Endmember to xeos for kals + +
    [docs]/** + Update dpdx matrix of pl4tr_mp */ -void p2x_alk_kals(void *SS_ref_db, double eps){ +void dpdx_mp_pl4tr(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; + dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; + dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; }
    -
    [docs]/** - Endmember to xeos for lct + +
    [docs]/** + Update dpdx matrix of bi_mp */ -void p2x_alk_lct(void *SS_ref_db, double eps){ +void dpdx_mp_bi(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[0]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = x[3] + 3.0*x[1] + x[4] + x[2] - 1.0; dp_dx[0][1] = 3.0*x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = x[0] - 1.0; dp_dx[0][4] = x[0] - 1.0; dp_dx[0][5] = -2.0/3.0; + dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = -1.0/3.0; + dp_dx[2][0] = -x[3] - 3.0*x[1] - x[4] - x[2]; dp_dx[2][1] = -3.0*x[0]; dp_dx[2][2] = -x[0]; dp_dx[2][3] = -x[0]; dp_dx[2][4] = -x[0]; dp_dx[2][5] = 1.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; dp_dx[4][5] = 0.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 1.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; + dp_dx[6][0] = 0.0; dp_dx[6][1] = 1.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; }
    -
    [docs]/** - Endmember to xeos for mel + + +
    [docs]/** + Update dpdx matrix of g_mp */ -void p2x_alk_mel(void *SS_ref_db, double eps){ +void dpdx_mp_g(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[3] = d->p[4]; - d->iguess[1] = 0.5*d->p[3]; - d->iguess[2] = 2.0*d->iguess[1] + d->p[0]; - d->iguess[0] = (d->iguess[3] + d->p[1] + d->iguess[2] - 1.0)/(d->iguess[3] + d->iguess[2] - 1.0); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = x[2] + x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = -1.0; + dp_dx[1][0] = -x[2] - x[1] + 1.0; dp_dx[1][1] = -x[0]; dp_dx[1][2] = -x[0]; dp_dx[1][3] = 0.0; + dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 1.0; dp_dx[2][3] = 0.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; }
    -
    [docs]/** - Endmember to xeos for fl + + +
    [docs]/** + Update dpdx matrix of ep_mp */ -void p2x_alk_fl(void *SS_ref_db, double eps){ +void dpdx_mp_ep(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[2] = d->p[3]; - d->iguess[1] = d->p[2]; - d->iguess[0] = d->p[1]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; + dp_dx[1][0] = 0.0; dp_dx[1][1] = 2.0; + dp_dx[2][0] = 1.0; dp_dx[2][1] = -1.0; }
    -
    [docs]/** - Endmember to xeos for liq +
    [docs]/** + Update dpdx matrix of ma_mp */ -void p2x_alk_liq(void *SS_ref_db, double eps){ +void dpdx_mp_ma(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[10] = d->p[10]; - d->iguess[11] = d->p[11]; - d->iguess[12] = d->p[12]; - d->iguess[13] = d->p[13]; - d->iguess[9] = 6.0*d->p[14]/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[8] = (6.0*d->p[9] + 6.0*d->iguess[13])/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[7] = 6.0*d->p[8]/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[6] = 6.0*d->p[7]/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[5] = 6.0*d->p[6]/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[4] = (6.0*d->p[5] + 6.0*d->iguess[11])/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[3] = 6.0*d->p[4]/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[2] = (6.0*d->p[3] + 3.0*d->iguess[12])/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[0] = (6.0*d->p[2] + 6.0*d->iguess[10])/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - d->iguess[1] = (6.0*d->p[1] + 3.0*d->iguess[11] + 6.0*d->iguess[10] + 3.0*d->iguess[13])/(7.0*d->iguess[11] + 6.0*d->iguess[10] - d->iguess[12] + 7.0*d->iguess[13] + 6.0); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -1.0; + dp_dx[1][0] = x[1] - 1.0; dp_dx[1][1] = x[0] - 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; + dp_dx[2][0] = 1.0 - x[1]; dp_dx[2][1] = -x[0]; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; }
    -
    [docs]/** - endmembers to xeos (biotite) +
    [docs]/** + Update dpdx matrix of mu_mp */ -void p2x_alk_bi(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; +void dpdx_mp_mu(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; - d->iguess[0] = (d->p[0]-2.0*d->p[1]+d->p[5]+d->p[4]+d->p[3] -1.0)/(d->p[3]+d->p[4]+d->p[5]-3.0); - d->iguess[1] = d->p[3]; - d->iguess[2] = d->p[5]; - d->iguess[3] = d->p[4]; - d->iguess[4] = 3.0*( (d->p[0]-2.0*d->p[1]+d->p[5]+d->p[4]+d->p[3] -1.0)/(d->p[3]+d->p[4]+d->p[5]-3.0) -d->p[1]); + dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -1.0; + dp_dx[1][0] = x[1] - 1.0; dp_dx[1][1] = x[0] - 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; + dp_dx[2][0] = 1.0 - x[1]; dp_dx[2][1] = -x[0]; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; +}
    +
    [docs]/** + Update dpdx matrix of opx_mp +*/ +void dpdx_mp_opx(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; - if (d->z_em[4] == 0.0){ d->iguess[3] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[2] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + dp_dx[0][0] = x[4] + x[1] - 1.0; dp_dx[0][1] = 0.5*x[5] + x[0] - 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = 0.5*x[5] + x[0] - 1.0; dp_dx[0][5] = 0.5*x[4] + 0.5*x[1] - 0.5; + dp_dx[1][0] = -x[3] - x[1] - x[2] + 1.0; dp_dx[1][1] = 0.5*x[5] - x[0]; dp_dx[1][2] = -x[0]; dp_dx[1][3] = -x[0]; dp_dx[1][4] = 0.5*x[5]; dp_dx[1][5] = 0.5*x[4] + 0.5*x[1] - 0.5; + dp_dx[2][0] = -x[4] + x[3] + x[2]; dp_dx[2][1] = -x[5]; dp_dx[2][2] = x[0]; dp_dx[2][3] = x[0]; dp_dx[2][4] = -x[5] - x[0]; dp_dx[2][5] = -x[4] - x[1] + 1.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 1.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; + dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 1.0; dp_dx[6][5] = 0.0; }
    -
    [docs]/** - endmembers to xeos (cordierite) +
    [docs]/** + Update dpdx matrix of sa_mp */ -void p2x_alk_cd(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - d->iguess[1] = d->p[2]; - - if (d->z_em[2] == 0.0){ d->iguess[1] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } +void dpdx_mp_sa(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -0.25; + dp_dx[1][0] = 0.0; dp_dx[1][1] = 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; + dp_dx[2][0] = -x[2] - x[1] + 1.0; dp_dx[2][1] = -x[0]; dp_dx[2][2] = -x[0]; dp_dx[2][3] = -0.75; + dp_dx[3][0] = x[2] + x[1]; dp_dx[3][1] = x[0]; dp_dx[3][2] = x[0]; dp_dx[3][3] = 1.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 1.0; dp_dx[4][3] = 0.0; }
    -
    [docs]/** - endmembers to xeos (clinopyroxene) +
    [docs]/** + Update dpdx matrix of cd_mp */ -void p2x_alk_cpx(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1] + d->p[8])/(d->p[1] - d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] + d->p[7] + d->p[8] - d->p[9] + 1.0); - d->iguess[1] = d->p[2] + d->p[3] + d->p[4] + d->p[5]; - d->iguess[2] = d->p[1]+d->p[7]+d->p[8]; - d->iguess[3] = d->p[6]; - d->iguess[4] = (d->p[7] + ((2.0*d->p[1] + d->p[8])/(d->p[1] - d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] + d->p[7] + d->p[8] - d->p[9] + 1.0) - 1.0)*(d->p[1] + d->p[7] + d->p[8]))/(-d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] - d->p[9] + 1.0); - d->iguess[5] = d->p[4]; - d->iguess[6] = d->p[3]; - d->iguess[7] = d->p[5]/2.0; - d->iguess[8] = d->p[9]; +void dpdx_mp_cd(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; - if (d->z_em[3] == 0.0){ d->iguess[6] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[5] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[7] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } + dp_dx[0][0] = x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = -1.0; + dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = -x[0]; dp_dx[1][2] = 0.0; + dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 1.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.0; dp_dx[3][2] = 0.0; }
    -
    [docs]/** - endmembers to xeos (epidote) +
    [docs]/** + Update dpdx matrix of st_mp */ -void p2x_alk_ep(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[2] + d->p[1]/2.0; - d->iguess[1] = d->p[1]/2.0; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (garnet) -*/ -void p2x_alk_g(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (d->p[0]+d->p[4]+d->p[5]+d->p[2]+d->p[3]-1.0)/(-1.0+d->p[2]+d->p[3]); - d->iguess[1] = d->p[2]+d->p[3]; - d->iguess[2] = d->p[3]; - d->iguess[3] = d->p[4]; - d->iguess[4] = d->p[5]/4.0; - - if (d->z_em[3] == 0.0){ d->iguess[2] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[3] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[4] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (hornblende) -*/ -void p2x_alk_hb(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0); - d->iguess[1] = (d->p[1]-d->p[0] + 1.0-d->p[3]-d->p[8]-d->p[4]-d->p[6]-d->p[5]-d->p[7] -2*d->p[8] - d->p[10] + 2*(d->p[3] + d->p[8]))/2.0; - d->iguess[2] = d->p[3] + d->p[8]; - d->iguess[3] = d->p[2] + d->p[9]; - d->iguess[4] = d->p[9]/(d->p[2]+d->p[9]); - d->iguess[5] = 1.0-d->p[3]-d->p[8]-d->p[4]-d->p[6]-d->p[5]-d->p[7]; - d->iguess[6] = d->p[8]; - d->iguess[7] = d->p[10]; - d->iguess[8] = (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0) -d->p[5] -d->p[7]; - d->iguess[9] = (d->p[5] + d->p[6] - (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])*(0.5*d->p[0] - 0.5*d->p[1] - 0.5*d->p[10] - 0.5*d->p[3] + 0.5*d->p[4] + 0.5*d->p[5] + 0.5*d->p[6] + 0.5*d->p[7] - 0.5*d->p[8] + 0.5)/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0))/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 0.5*d->p[4] - 0.5*d->p[5] - 0.5*d->p[6] - 0.5*d->p[7] + 0.5*d->p[8] - 0.5); - - if (d->z_em[8] == 0){ d->iguess[6] = eps;} - if (d->z_em[10] == 0){ d->iguess[7] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (ilm) -*/ -/** DEPRECATED */ -void p2x_alk_ilm(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]+d->p[0]; - d->iguess[1] = d->p[0]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (olivine) -*/ -void p2x_alk_ol(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1]+d->p[3])/(2.0-d->p[0]); - d->iguess[1] = d->p[0]; - d->iguess[2] = -d->p[0] - d->p[2] + 1.0 + (d->p[0] - 1.0)*(2.0*d->p[1] + d->p[3])/(2.0 - d->p[0]); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (orthopyroxene) -*/ -void p2x_alk_opx(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1] + d->p[2])/(d->p[0] + d->p[1] + d->p[2] + 0.5*d->p[6] - d->p[8] + 1.0); - d->iguess[1] = 1.0 - d->p[3] - d->p[8] - d->p[0] - d->p[1] - d->p[2]; - d->iguess[2] = d->p[3]; - d->iguess[3] = (d->p[1] + d->p[2] + (2.0*d->p[1] + d->p[2])*(d->p[3] + d->p[8] - 1.0)/(d->p[0] + d->p[1] + d->p[2] + 0.5*d->p[6] - d->p[8] + 1.0))/(-d->p[0] - d->p[1] - d->p[2] - d->p[3] - 0.5*d->p[6]); - d->iguess[4] = d->p[7]; - d->iguess[5] = d->p[6]/2.0; - d->iguess[6] = d->p[5]; - d->iguess[7] = d->p[8]; - - if (d->z_em[5] == 0.0){ d->iguess[6] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[4] = eps;} - if (d->z_em[6] == 0.0){ d->iguess[5] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (plagioclase) -*/ -void p2x_alk_fsp(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - d->iguess[1] = d->p[2]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (spinel) -*/ -void p2x_alk_spn(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[2] = d->p[6]; - d->iguess[3] = d->p[7]; - d->iguess[1] = (-d->p[4] - d->p[5])/(d->iguess[2] + d->iguess[3] - 1.0); - d->iguess[0] = (-d->iguess[2] - d->p[0] - d->p[1] + d->iguess[3] + 1.0)/(d->iguess[3] + 1.0); - d->iguess[4] = -3.0*d->p[1]/2.0 - d->iguess[3]*d->iguess[0] + d->iguess[3] - d->iguess[0] + 1.0; - d->iguess[6] = d->iguess[2]*d->iguess[1] + 3.0*d->p[5]/2.0 + d->iguess[3]*d->iguess[1] - d->iguess[1]; - d->iguess[5] = -d->iguess[6] + d->iguess[2]*d->iguess[1] - 3.0*d->p[3]/2.0 + d->iguess[3]*d->iguess[0] + d->iguess[3]*d->iguess[1] - 3.0*d->iguess[3]/2.0 + d->iguess[0] - d->iguess[1]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - - - -
    [docs]/** - Update dpdx matrix of liq -*/ -void dpdx_alk_liq(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][1] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][2] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][3] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][4] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][5] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][6] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][7] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][8] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][9] =-x[10] - 7.0/6.0*x[11] + 1.0/6.0*x[12] - 7.0/6.0*x[13] - 1.0; dp_dx[0][10] =-x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; dp_dx[0][11] = -7.0/6.0*x[0] - 7.0/6.0*x[1] - 7.0/6.0*x[2] - 7.0/6.0*x[3] - 7.0/6.0*x[4] - 7.0/6.0*x[5] - 7.0/6.0*x[6] - 7.0/6.0*x[7] - 7.0/6.0*x[8] - 7.0/6.0*x[9] + 0.5; dp_dx[0][12] = 1.0/6.0*x[0] + 1.0/6.0*x[1] + 1.0/6.0*x[2] + 1.0/6.0*x[3] + 1.0/6.0*x[4] + 1.0/6.0*x[5] + 1.0/6.0*x[6] + 1.0/6.0*x[7] + 1.0/6.0*x[8] + 1.0/6.0*x[9] - 0.5; dp_dx[0][13] = -7.0/6.0*x[0] - 7.0/6.0*x[1] - 7.0/6.0*x[2] - 7.0/6.0*x[3] - 7.0/6.0*x[4] - 7.0/6.0*x[5] - 7.0/6.0*x[6] - 7.0/6.0*x[7] - 7.0/6.0*x[8] - 7.0/6.0*x[9] + 0.5; - dp_dx[1][0] = 0.0; dp_dx[1][1] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 0.0; dp_dx[1][10] = x[1] - 1.0; dp_dx[1][11] = 7.0/6.0*x[1] - 0.5; dp_dx[1][12] = -1.0/6.0*x[1]; dp_dx[1][13] = 7.0/6.0*x[1] - 0.5; - dp_dx[2][0] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 0.0; dp_dx[2][10] = x[0] - 1.0; dp_dx[2][11] = 7.0/6.0*x[0]; dp_dx[2][12] = -1.0/6.0*x[0]; dp_dx[2][13] = 7.0/6.0*x[0]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 0.0; dp_dx[3][10] = x[2]; dp_dx[3][11] = 7.0/6.0*x[2]; dp_dx[3][12] = -1.0/6.0*x[2] - 0.5; dp_dx[3][13] = 7.0/6.0*x[2]; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; dp_dx[4][9] = 0.0; dp_dx[4][10] = x[3]; dp_dx[4][11] = 7.0/6.0*x[3]; dp_dx[4][12] = -1.0/6.0*x[3]; dp_dx[4][13] = 7.0/6.0*x[3]; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 0.0; dp_dx[5][8] = 0.0; dp_dx[5][9] = 0.0; dp_dx[5][10] = x[4]; dp_dx[5][11] = 7.0/6.0*x[4] - 1.0; dp_dx[5][12] = -1.0/6.0*x[4]; dp_dx[5][13] = 7.0/6.0*x[4]; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; dp_dx[6][9] = 0.0; dp_dx[6][10] = x[5]; dp_dx[6][11] = 7.0/6.0*x[5]; dp_dx[6][12] = -1.0/6.0*x[5]; dp_dx[6][13] = 7.0/6.0*x[5]; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[7][7] = 0.0; dp_dx[7][8] = 0.0; dp_dx[7][9] = 0.0; dp_dx[7][10] = x[6]; dp_dx[7][11] = 7.0/6.0*x[6]; dp_dx[7][12] = -1.0/6.0*x[6]; dp_dx[7][13] = 7.0/6.0*x[6]; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 0.0; dp_dx[8][10] = x[7]; dp_dx[8][11] = 7.0/6.0*x[7]; dp_dx[8][12] = -1.0/6.0*x[7]; dp_dx[8][13] = 7.0/6.0*x[7]; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[9][9] = 0.0; dp_dx[9][10] = x[8]; dp_dx[9][11] = 7.0/6.0*x[8]; dp_dx[9][12] = -1.0/6.0*x[8]; dp_dx[9][13] = 7.0/6.0*x[8] - 1.0; - dp_dx[10][0] = 0.0; dp_dx[10][1] = 0.0; dp_dx[10][2] = 0.0; dp_dx[10][3] = 0.0; dp_dx[10][4] = 0.0; dp_dx[10][5] = 0.0; dp_dx[10][6] = 0.0; dp_dx[10][7] = 0.0; dp_dx[10][8] = 0.0; dp_dx[10][9] = 0.0; dp_dx[10][10] = 1.00; dp_dx[10][11] = 0.0; dp_dx[10][12] = 0.0; dp_dx[10][13] = 0.0; - dp_dx[11][0] = 0.0; dp_dx[11][1] = 0.0; dp_dx[11][2] = 0.0; dp_dx[11][3] = 0.0; dp_dx[11][4] = 0.0; dp_dx[11][5] = 0.0; dp_dx[11][6] = 0.0; dp_dx[11][7] = 0.0; dp_dx[11][8] = 0.0; dp_dx[11][9] = 0.0; dp_dx[11][10] = 0.0; dp_dx[11][11] = 1.00; dp_dx[11][12] = 0.0; dp_dx[11][13] = 0.0; - dp_dx[12][0] = 0.0; dp_dx[12][1] = 0.0; dp_dx[12][2] = 0.0; dp_dx[12][3] = 0.0; dp_dx[12][4] = 0.0; dp_dx[12][5] = 0.0; dp_dx[12][6] = 0.0; dp_dx[12][7] = 0.0; dp_dx[12][8] = 0.0; dp_dx[12][9] = 0.0; dp_dx[12][10] = 0.0; dp_dx[12][11] = 0.0; dp_dx[12][12] = 1.00; dp_dx[12][13] = 0.0; - dp_dx[13][0] = 0.0; dp_dx[13][1] = 0.0; dp_dx[13][2] = 0.0; dp_dx[13][3] = 0.0; dp_dx[13][4] = 0.0; dp_dx[13][5] = 0.0; dp_dx[13][6] = 0.0; dp_dx[13][7] = 0.0; dp_dx[13][8] = 0.0; dp_dx[13][9] = 0.0; dp_dx[13][10] = 0.0; dp_dx[13][11] = 0.0; dp_dx[13][12] = 0.0; dp_dx[13][13] = 1.00; - dp_dx[14][0] = 0.0; dp_dx[14][1] = 0.0; dp_dx[14][2] = 0.0; dp_dx[14][3] = 0.0; dp_dx[14][4] = 0.0; dp_dx[14][5] = 0.0; dp_dx[14][6] = 0.0; dp_dx[14][7] = 0.0; dp_dx[14][8] = 0.0; dp_dx[14][9] = x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0; dp_dx[14][10] = x[9]; dp_dx[14][11] = 7.0/6.0*x[9]; dp_dx[14][12] = -1.0/6.0*x[9]; dp_dx[14][13] = 7.0/6.0*x[9]; -}
    - - -
    [docs]/** - Update dpdx matrix of fl -*/ -void dpdx_alk_fl(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.00; dp_dx[0][1] = -1.00; dp_dx[0][2] = -1.00; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.00; dp_dx[2][2] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of fsp -*/ -void dpdx_alk_fsp(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.00; dp_dx[0][1] = -1.00; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of spn -*/ -void dpdx_alk_spn(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0/3.0*x[3] - 1.0/3.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = -1.00; dp_dx[0][3] = 1.0/3.0 - 1.0/3.0*x[0]; dp_dx[0][4] = 2.0/3.0; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; - dp_dx[1][0] = -2.0/3.0*x[3] - 2.0/3.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 2.0/3.0 - 2.0/3.0*x[0]; dp_dx[1][4] = -2.0/3.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; - dp_dx[2][0] = 1.0/3.0*x[3] + 1.0/3.0; dp_dx[2][1] = 1.0/3.0*x[2] + 1.0/3.0*x[3] - 1.0/3.0; dp_dx[2][2] = 1.0/3.0*x[1]; dp_dx[2][3] = 1.0/3.0*x[0] + 1.0/3.0*x[1] - 1.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 2.0/3.0; dp_dx[2][6] = 2.0/3.0; - dp_dx[3][0] = 2.0/3.0*x[3] + 2.0/3.0; dp_dx[3][1] = 2.0/3.0*x[2] + 2.0/3.0*x[3] - 2.0/3.0; dp_dx[3][2] = 2.0/3.0*x[1]; dp_dx[3][3] = 2.0/3.0*x[0] + 2.0/3.0*x[1] - 1.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = -2.0/3.0; dp_dx[3][6] = -2.0/3.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = -1.0/3.0*x[2] - 1.0/3.0*x[3] + 1.0/3.0; dp_dx[4][2] = -1.0/3.0*x[1]; dp_dx[4][3] = -1.0/3.0*x[1]; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = -2.0/3.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = -2.0/3.0*x[2] - 2.0/3.0*x[3] + 2.0/3.0; dp_dx[5][2] = -2.0/3.0*x[1]; dp_dx[5][3] = -2.0/3.0*x[1]; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 2.0/3.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 1.00; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; dp_dx[6][6] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 1.00; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of g -*/ -void dpdx_alk_g(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = 0.0; dp_dx[0][3] = -1.00; dp_dx[0][4] = -4.00; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] =-x[0]; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.00; dp_dx[2][2] = -1.00; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.00; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.00; dp_dx[4][4] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 4.00; -}
    - - -
    [docs]/** - Update dpdx matrix of ol -*/ -void dpdx_alk_ol(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.00; dp_dx[0][2] = 0.0; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; dp_dx[1][2] = -1.00; - dp_dx[2][0] = x[1] - 1.0; dp_dx[2][1] = x[0] - 1.0; dp_dx[2][2] = -1.00; - dp_dx[3][0] =-x[1]; dp_dx[3][1] =-x[0]; dp_dx[3][2] = 2.00; -}
    - - -
    [docs]/** - Update dpdx matrix of opx -*/ -void dpdx_alk_opx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[2] + x[7] - 1.0; dp_dx[0][1] =-x[3] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] =-x[1] + x[5] - x[7] + 1.0; dp_dx[0][4] = 0.0; dp_dx[0][5] = x[3]; dp_dx[0][6] = 0.0; dp_dx[0][7] = x[0] - x[3] - 1.0; - dp_dx[1][0] =-x[1] + x[5] - x[7] + 1.0; dp_dx[1][1] =-x[0] - x[3]; dp_dx[1][2] = 0.0; dp_dx[1][3] =-x[1] + x[5] - x[7] + 1.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = x[0] + x[3]; dp_dx[1][6] = 0.0; dp_dx[1][7] =-x[0] - x[3]; - dp_dx[2][0] = x[1] - x[2] - x[5]; dp_dx[2][1] = x[0] + 2.0*x[3]; dp_dx[2][2] =-x[0]; dp_dx[2][3] = 2.0*x[1] - 2.0*x[5] + 2.0*x[7] - 2.0; dp_dx[2][4] = 0.0; dp_dx[2][5] =-x[0] - 2.0*x[3]; dp_dx[2][6] = 0.0; dp_dx[2][7] = 2.0*x[3]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.00; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 1.00; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = -1.00; dp_dx[4][5] = -2.00; dp_dx[4][6] = -1.00; dp_dx[4][7] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 1.00; dp_dx[5][7] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 2.00; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 1.00; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; dp_dx[7][7] = 0.0; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of cpx -*/ -void dpdx_alk_cpx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = -1.00; dp_dx[0][2] = -1.00; dp_dx[0][3] = -1.00; dp_dx[0][4] = 0.0; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; dp_dx[0][7] = 0.0; dp_dx[0][8] = -1.00; - dp_dx[1][0] =-x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[1][1] =-x[0] - x[4]; dp_dx[1][2] = 0.0; dp_dx[1][3] =-x[0] - x[4]; dp_dx[1][4] =-x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = x[0] + x[4]; dp_dx[1][8] =-x[0] - x[4]; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.00; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = -1.00; dp_dx[2][6] = -1.00; dp_dx[2][7] = -2.00; dp_dx[2][8] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 1.00; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 1.00; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 2.00; dp_dx[5][8] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 1.00; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; - dp_dx[7][0] =-x[2]; dp_dx[7][1] =-x[4]; dp_dx[7][2] = 1.0 - x[0]; dp_dx[7][3] =-x[4]; dp_dx[7][4] =-x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; dp_dx[7][7] = x[4]; dp_dx[7][8] =-x[4]; - dp_dx[8][0] = x[1] + x[2] + x[3] - x[7] + x[8] - 1.0; dp_dx[8][1] = x[0] + 2.0*x[4]; dp_dx[8][2] = x[0]; dp_dx[8][3] = x[0] + 2.0*x[4]; dp_dx[8][4] = 2.0*x[1] + 2.0*x[3] - 2.0*x[7] + 2.0*x[8] - 2.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] =-x[0] - 2.0*x[4]; dp_dx[8][8] = x[0] + 2.0*x[4]; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of ilm -*/ -void dpdx_alk_ilm(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = 1.00; dp_dx[0][3] = 0.0; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] =-x[0]; dp_dx[1][2] = -1.00; dp_dx[1][3] = 0.0; - dp_dx[2][0] = -1.00; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = -1.00; dp_dx[3][3] = 1.00; - dp_dx[4][0] = x[1]; dp_dx[4][1] = x[0]; dp_dx[4][2] = 1.00; dp_dx[4][3] = -1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of ness -*/ -void dpdx_alk_ness(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.25*x[1] - 1.0; dp_dx[0][1] = 0.25*x[0] + 0.75*x[4] - 1.0; dp_dx[0][2] = -0.750; dp_dx[0][3] = -1.00; dp_dx[0][4] = 0.75*x[1]; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = -3.00; - dp_dx[2][0] = -0.25*x[1]; dp_dx[2][1] = -0.25*x[0] - 0.75*x[4] + 1.0; dp_dx[2][2] = -0.250; dp_dx[2][3] = 0.0; dp_dx[2][4] = -0.75*x[1]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.00; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 3.00; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 1.00; dp_dx[5][4] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of lct -*/ -void dpdx_alk_lct(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 1.00; - dp_dx[1][0] = -1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of kals -*/ -void dpdx_alk_kals(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.00; - dp_dx[1][0] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of mel -*/ -void dpdx_alk_mel(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = -2.00; dp_dx[0][2] = 1.00; dp_dx[0][3] = 0.0; - dp_dx[1][0] = x[2] + x[3] - 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = x[0] - 1.0; dp_dx[1][3] = x[0] - 1.0; - dp_dx[2][0] =-x[2] - x[3] + 1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] =-x[0]; dp_dx[2][3] =-x[0]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 2.00; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of hb -*/ -void dpdx_alk_hb(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = -1.00; dp_dx[0][2] = 1.00; dp_dx[0][3] = -0.500; dp_dx[0][4] = 0.0; dp_dx[0][5] = 1.00; dp_dx[0][6] = -1.00; dp_dx[0][7] = -1.00; dp_dx[0][8] = 0.0; dp_dx[0][9] = 0.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 1.00; dp_dx[1][2] = -1.00; dp_dx[1][3] = -0.500; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 1.00; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 1.0 - x[4]; dp_dx[2][4] =-x[3]; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.00; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = -1.00; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 0.0; - dp_dx[4][0] = x[2] + x[5] - 1.0; dp_dx[4][1] = x[9]; dp_dx[4][2] = x[0] - 1.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = x[0] - 1.0; dp_dx[4][6] = x[9]; dp_dx[4][7] = x[9]; dp_dx[4][8] = -1.50; dp_dx[4][9] = x[1] + x[6] + x[7] - 1.0; - dp_dx[5][0] =-x[1] + x[2] + x[5] - x[6] - x[7] + 1.0; dp_dx[5][1] =-x[0] + 2.0*x[9]; dp_dx[5][2] = x[0]; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = x[0]; dp_dx[5][6] =-x[0] + 2.0*x[9]; dp_dx[5][7] =-x[0] + 2.0*x[9]; dp_dx[5][8] = -2.50; dp_dx[5][9] = 2.0*x[1] + 2.0*x[6] + 2.0*x[7] - 2.0; - dp_dx[6][0] =-x[2] - x[5]; dp_dx[6][1] =-x[9]; dp_dx[6][2] =-x[0]; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] =-x[0]; dp_dx[6][6] =-x[9]; dp_dx[6][7] =-x[9]; dp_dx[6][8] = 2.50; dp_dx[6][9] =-x[1] - x[6] - x[7] + 1.0; - dp_dx[7][0] = x[1] - x[2] - x[5] + x[6] + x[7]; dp_dx[7][1] = x[0] - 2.0*x[9]; dp_dx[7][2] =-x[0]; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] =-x[0]; dp_dx[7][6] = x[0] - 2.0*x[9]; dp_dx[7][7] = x[0] - 2.0*x[9]; dp_dx[7][8] = 1.50; dp_dx[7][9] = -2.0*x[1] - 2.0*x[6] - 2.0*x[7] + 2.0; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 1.00; dp_dx[8][7] = 0.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 0.0; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = x[4]; dp_dx[9][4] = x[3]; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 0.0; dp_dx[9][9] = 0.0; - dp_dx[10][0] = 0.0; dp_dx[10][1] = 0.0; dp_dx[10][2] = 0.0; dp_dx[10][3] = 0.0; dp_dx[10][4] = 0.0; dp_dx[10][5] = 0.0; dp_dx[10][6] = 0.0; dp_dx[10][7] = 1.00; dp_dx[10][8] = 0.0; dp_dx[10][9] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of bi -*/ -void dpdx_alk_bi(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[1] + x[2] + x[3] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = x[0] - 1.0; dp_dx[0][4] = -2.0/3.0; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = -1.0/3.0; - dp_dx[2][0] =-x[1] - x[2] - x[3]; dp_dx[2][1] =-x[0]; dp_dx[2][2] =-x[0]; dp_dx[2][3] =-x[0]; dp_dx[2][4] = 1.00; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.00; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.00; dp_dx[4][4] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.00; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of ep -*/ -void dpdx_alk_ep(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.00; dp_dx[0][1] = -1.00; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 2.00; - dp_dx[2][0] = 1.00; dp_dx[2][1] = -1.00; -}
    - - -
    [docs]/** - Update dpdx matrix of cd -*/ -void dpdx_alk_cd(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.00; dp_dx[0][1] = -1.00; - dp_dx[1][0] = 1.00; dp_dx[1][1] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.00; -}
    - - -
    [docs]/** - Endmember fraction of liq -*/ -void px_alk_liq(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[0] + x[10]*(-1.0*x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) + 1.0/6.0*x[11]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) + 1.0/6.0*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) + 1.0/6.0*x[13]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; - p[1] = x[10]*x[1] - x[10] + 7.0/6.0*x[11]*x[1] - 0.5*x[11] - 1.0/6.0*x[12]*x[1] + 7.0/6.0*x[13]*x[1] - 0.5*x[13] + x[1]; - p[2] = x[0]*x[10] + 7.0/6.0*x[0]*x[11] - 1.0/6.0*x[0]*x[12] + 7.0/6.0*x[0]*x[13] + x[0] - x[10]; - p[3] = x[10]*x[2] + 7.0/6.0*x[11]*x[2] - 1.0/6.0*x[12]*x[2] - 0.5*x[12] + 7.0/6.0*x[13]*x[2] + x[2]; - p[4] = x[10]*x[3] + 7.0/6.0*x[11]*x[3] - 1.0/6.0*x[12]*x[3] + 7.0/6.0*x[13]*x[3] + x[3]; - p[5] = x[10]*x[4] + 7.0/6.0*x[11]*x[4] - x[11] - 1.0/6.0*x[12]*x[4] + 7.0/6.0*x[13]*x[4] + x[4]; - p[6] = x[10]*x[5] + 7.0/6.0*x[11]*x[5] - 1.0/6.0*x[12]*x[5] + 7.0/6.0*x[13]*x[5] + x[5]; - p[7] = x[10]*x[6] + 7.0/6.0*x[11]*x[6] - 1.0/6.0*x[12]*x[6] + 7.0/6.0*x[13]*x[6] + x[6]; - p[8] = x[10]*x[7] + 7.0/6.0*x[11]*x[7] - 1.0/6.0*x[12]*x[7] + 7.0/6.0*x[13]*x[7] + x[7]; - p[9] = x[10]*x[8] + 7.0/6.0*x[11]*x[8] - 1.0/6.0*x[12]*x[8] + 7.0/6.0*x[13]*x[8] - x[13] + x[8]; - p[10] = x[10]; - p[11] = x[11]; - p[12] = x[12]; - p[13] = x[13]; - p[14] = x[10]*x[9] + 7.0/6.0*x[11]*x[9] - 1.0/6.0*x[12]*x[9] + 7.0/6.0*x[13]*x[9] + x[9]; -}
    - - -
    [docs]/** - Endmember fraction of fl -*/ -void px_alk_fl(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[0] - x[1] - x[2] + 1.0; - p[1] = x[0]; - p[2] = x[1]; - p[3] = x[2]; -}
    - - -
    [docs]/** - Endmember fraction of fsp -*/ -void px_alk_fsp(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[0] - x[1] + 1.0; - p[1] = x[0]; - p[2] = x[1]; -}
    - - -
    [docs]/** - Endmember fraction of spn -*/ -void px_alk_spn(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] - x[2] + 1.0/3.0*x[3] + 2.0/3.0*x[4] + 1.0/3.0; - p[1] = -2.0/3.0*x[0]*x[3] - 2.0/3.0*x[0] + 2.0/3.0*x[3] - 2.0/3.0*x[4] + 2.0/3.0; - p[2] = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] + 1.0/3.0*x[1]*x[2] + 1.0/3.0*x[1]*x[3] - 1.0/3.0*x[1] - x[3] + 2.0/3.0*x[5] + 2.0/3.0*x[6]; - p[3] = 2.0/3.0*x[0]*x[3] + 2.0/3.0*x[0] + 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - x[3] - 2.0/3.0*x[5] - 2.0/3.0*x[6]; - p[4] = -1.0/3.0*x[1]*x[2] - 1.0/3.0*x[1]*x[3] + 1.0/3.0*x[1] - 2.0/3.0*x[6]; - p[5] = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + 2.0/3.0*x[6]; - p[6] = x[2]; - p[7] = x[3]; -}
    - - -
    [docs]/** - Endmember fraction of g -*/ -void px_alk_g(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[1] - x[0] - x[1] - x[3] - 4.0*x[4] + 1.0; - p[1] =-x[0]*x[1] + x[0]; - p[2] = x[1] - x[2]; - p[3] = x[2]; - p[4] = x[3]; - p[5] = 4.0*x[4]; -}
    - - -
    [docs]/** - Endmember fraction of ol -*/ -void px_alk_ol(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[1]; - p[1] = x[0] - x[2]; - p[2] = x[0]*x[1] - x[0] - x[1] - x[2] + 1.0; - p[3] =-x[0]*x[1] + 2.0*x[2]; -}
    - - -
    [docs]/** - Endmember fraction of opx -*/ -void px_alk_opx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] - x[1] - x[2] + x[3]*x[5] - x[3]*x[7] + x[3] - x[7] + 1.0; - p[1] =-x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]; - p[2] = x[0]*x[1] - x[0]*x[2] - x[0]*x[5] + 2.0*x[1]*x[3] - 2.0*x[3]*x[5] + 2.0*x[3]*x[7] - 2.0*x[3]; - p[3] = x[2]; - p[4] = x[1] - x[4] - 2.0*x[5] - x[6]; - p[5] = x[6]; - p[6] = 2.0*x[5]; - p[7] = x[4]; - p[8] = x[7]; -}
    - - -
    [docs]/** - Endmember fraction of cpx -*/ -void px_alk_cpx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[1] - x[2] - x[3] - x[8] + 1.0; - p[1] =-x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - p[2] = x[1] - x[5] - x[6] - 2.0*x[7]; - p[3] = x[6]; - p[4] = x[5]; - p[5] = 2.0*x[7]; - p[6] = x[3]; - p[7] =-x[0]*x[2] - x[1]*x[4] + x[2] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - p[8] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + 2.0*x[1]*x[4] + 2.0*x[3]*x[4] - 2.0*x[4]*x[7] + 2.0*x[4]*x[8] - 2.0*x[4]; - p[9] = x[8]; -}
    - - -
    [docs]/** - Endmember fraction of ilm -*/ -void px_alk_ilm(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[2]; - p[1] =-x[0]*x[1] + x[0] - x[2]; - p[2] = 1.0 - x[0]; - p[3] =-x[2] + x[3]; - p[4] = x[0]*x[1] + x[2] - x[3]; -}
    - - -
    [docs]/** - Endmember fraction of ness -*/ -void px_alk_ness(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = 0.25*x[0]*x[1] - x[0] + 0.75*x[1]*x[4] - x[1] - 0.75*x[2] - x[3] + 1.0; - p[1] = x[0] - 3.0*x[4]; - p[2] = -0.25*x[0]*x[1] - 0.75*x[1]*x[4] + x[1] - 0.25*x[2]; - p[3] = x[2]; - p[4] = 3.0*x[4]; - p[5] = x[3]; -}
    - - -
    [docs]/** - Endmember fraction of lct -*/ -void px_alk_lct(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]; - p[1] = 1.0 - x[0]; -}
    - - -
    [docs]/** - Endmember fraction of kals -*/ -void px_alk_kals(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = 1.0 - x[0]; - p[1] = x[0]; -}
    - - -
    [docs]/** - Endmember fraction of mel -*/ -void px_alk_mel(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = -2.0*x[1] + x[2]; - p[1] = x[0]*x[2] + x[0]*x[3] - x[0] - x[2] - x[3] + 1.0; - p[2] =-x[0]*x[2] - x[0]*x[3] + x[0]; - p[3] = 2.0*x[1]; - p[4] = x[3]; -}
    - - -
    [docs]/** - Endmember fraction of hb -*/ -void px_alk_hb(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[1] + x[2] - 0.5*x[3] + x[5] - x[6] - x[7]; - p[1] = x[1] - x[2] - 0.5*x[3] + x[6]; - p[2] =-x[3]*x[4] + x[3]; - p[3] = x[2] - x[6]; - p[4] = x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] - x[2] - x[5] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9] + 1.0; - p[5] =-x[0]*x[1] + x[0]*x[2] + x[0]*x[5] - x[0]*x[6] - x[0]*x[7] + x[0] + 2.0*x[1]*x[9] + 2.0*x[6]*x[9] + 2.0*x[7]*x[9] - 2.5*x[8] - 2.0*x[9]; - p[6] =-x[0]*x[2] - x[0]*x[5] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + 2.5*x[8] + x[9]; - p[7] = x[0]*x[1] - x[0]*x[2] - x[0]*x[5] + x[0]*x[6] + x[0]*x[7] - 2.0*x[1]*x[9] - 2.0*x[6]*x[9] - 2.0*x[7]*x[9] + 1.5*x[8] + 2.0*x[9]; - p[8] = x[6]; - p[9] = x[3]*x[4]; - p[10] = x[7]; -}
    - - -
    [docs]/** - Endmember fraction of bi -*/ -void px_alk_bi(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - x[1] - x[2] - x[3] - 2.0/3.0*x[4] + 1.0; - p[1] = x[0] - 1.0/3.0*x[4]; - p[2] =-x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[4]; - p[3] = x[1]; - p[4] = x[3]; - p[5] = x[2]; -}
    - - -
    [docs]/** - Endmember fraction of ep -*/ -void px_alk_ep(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[0] - x[1] + 1.0; - p[1] = 2.0*x[1]; - p[2] = x[0] - x[1]; -}
    - - -
    [docs]/** - Endmember fraction of cd -*/ -void px_alk_cd(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] =-x[0] - x[1] + 1.0; - p[1] = x[0]; - p[2] = x[1]; -}
    - - -
    [docs]/** - Objective function of liq -*/ -double obj_alk_liq(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_liq(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -x[0] + x[10]*(-1.0*x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) + 1.0/6.0*x[11]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) + 1.0/6.0*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) + 1.0/6.0*x[13]*(-7.0*x[0] - 7.0*x[1] - 7.0*x[2] - 7.0*x[3] - 7.0*x[4] - 7.0*x[5] - 7.0*x[6] - 7.0*x[7] - 7.0*x[8] - 7.0*x[9] + 3.0) - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; - sf[1] = x[10]*x[1] - x[10] + 7.0/6.0*x[11]*x[1] - 0.5*x[11] - 1.0/6.0*x[12]*x[1] + 7.0/6.0*x[13]*x[1] - 0.5*x[13] + x[1]; - sf[2] = x[0]*x[10] + 7.0/6.0*x[0]*x[11] - 1.0/6.0*x[0]*x[12] + 7.0/6.0*x[0]*x[13] + x[0] - x[10]; - sf[3] = x[10]*x[4] + 7.0/6.0*x[11]*x[4] - x[11] - 1.0/6.0*x[12]*x[4] + 7.0/6.0*x[13]*x[4] + x[4]; - sf[4] = x[10]*x[5] + 7.0/6.0*x[11]*x[5] - 1.0/6.0*x[12]*x[5] + 7.0/6.0*x[13]*x[5] + x[5]; - sf[5] = x[10]*x[6] + 7.0/6.0*x[11]*x[6] - 1.0/6.0*x[12]*x[6] + 7.0/6.0*x[13]*x[6] + x[6]; - sf[6] = x[10]*x[7] + 7.0/6.0*x[11]*x[7] - 1.0/6.0*x[12]*x[7] + 7.0/6.0*x[13]*x[7] + x[7]; - sf[7] = x[10]*x[8] + 7.0/6.0*x[11]*x[8] - 1.0/6.0*x[12]*x[8] + 7.0/6.0*x[13]*x[8] - x[13] + x[8]; - sf[8] = x[11]; - sf[9] = x[10]; - sf[10] = x[12]; - sf[11] = x[13]; - sf[12] = x[10]*(x[2] + x[3]) + 7.0/6.0*x[11]*(x[2] + x[3]) - 1.0/6.0*x[12]*(x[2] + x[3]) - 0.5*x[12] + 7.0/6.0*x[13]*(x[2] + x[3]) + x[2] + x[3]; - sf[13] = -x[10]*x[9] - 7.0/6.0*x[11]*x[9] + 1.0/6.0*x[12]*x[9] - 7.0/6.0*x[13]*x[9] - x[9] + 1.0; - sf[14] = x[10]*x[9] + 7.0/6.0*x[11]*x[9] - 1.0/6.0*x[12]*x[9] + 7.0/6.0*x[13]*x[9] + x[9]; - sf[15] = -x[10]*x[9] - 7.0/6.0*x[11]*x[9] + 1.0/6.0*x[12]*x[9] - 7.0/6.0*x[13]*x[9] - x[9] + 1.0; - sf[16] = -2.0*x[12] + 4.0*x[2]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0); - sf[17] = 4.0*x[3]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0); - sf[18] = x[0]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0) - x[10]; - sf[19] = -x[10] - 0.5*x[11] - 0.5*x[13] + x[1]*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0); - sf[20] = -2.0*x[10] - 0.5*x[11] - 2.0*x[12] - 0.5*x[13] + (x[0] + x[1] + 4.0*x[2] + 4.0*x[3])*(x[10] + 7.0/6.0*x[11] - 1.0/6.0*x[12] + 7.0/6.0*x[13] + 1.0); - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[19]*sf[1]*1.0/sf[20])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[18]*1.0/sf[20]*sf[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[12]*1.0/sf[13]*cpow(sf[15], 2.0)*cpow(sf[16], 4.0)*cpow(sf[20], -4.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[12]*1.0/sf[13]*cpow(sf[15], 2.0)*cpow(sf[17], 4.0)*cpow(sf[20], -4.0))) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[3])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[4] + d_em[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[5] + d_em[7])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[6])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[7])) + mu_Gex[9]; - mu[10] = gb[10] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[9])) + mu_Gex[10]; - mu[11] = gb[11] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[8])) + mu_Gex[11]; - mu[12] = gb[12] + R*T*creal(clog(sf[10]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[12]; - mu[13] = gb[13] + R*T*creal(clog(sf[11]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[13]; - mu[14] = gb[14] + R*T*creal(clog(cpow(sf[14], 2.0))) + mu_Gex[14]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_liq(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of fl -*/ -double obj_alk_fl(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_fl(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -x[0] - x[1] - x[2] + 1.0; - sf[1] = x[0]; - sf[2] = x[1]; - sf[3] = x[2]; - sf[4] = 1.0 - x[2]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[4])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[4])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[2]*sf[4])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[3], 2.0))) + mu_Gex[3]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_fl(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of fsp -*/ -double obj_alk_fsp(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_fsp(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -x[0] - x[1] + 1.0; - sf[1] = x[0]; - sf[2] = x[1]; - sf[3] = 0.25*x[0] + 0.25; - sf[4] = 0.75 - 0.25*x[0]; - - - mu[0] = gb[0] + R*T*creal(clog(1.7548*sf[0]*cpow(sf[3], 0.25)*cpow(sf[4], 0.75))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[1]*sqrt(sf[3])*sqrt(sf[4]))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.7548*sf[2]*cpow(sf[3], 0.25)*cpow(sf[4], 0.75))) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_fsp(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of spn -*/ -double obj_alk_spn(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_spn(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] + 2.0/3.0*x[4] + 1.0/3.0; - sf[1] = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] + 2.0/3.0*x[5]; - sf[2] = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - 1.0/3.0*x[3] - 2.0/3.0*x[4] - 2.0/3.0*x[5] - 2.0/3.0*x[6] + 2.0/3.0; - sf[3] = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + 2.0/3.0*x[6]; - sf[4] = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] - 1.0/3.0*x[4] + 1.0/3.0; - sf[5] = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] - 1.0/3.0*x[5]; - sf[6] = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - x[2] - 5.0/6.0*x[3] + 1.0/3.0*x[4] + 1.0/3.0*x[5] + 1.0/3.0*x[6] + 2.0/3.0; - sf[7] = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] - 1.0/3.0*x[6]; - sf[8] = x[2]; - sf[9] = 0.5*x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[6])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[4])*sqrt(sf[6]))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[1]*sf[6])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[5])*sqrt(sf[6]))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[1]*sf[7] + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(2.0*sf[3]*sqrt(sf[5])*sqrt(sf[7]) + d_em[5])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sf[0]*sf[8] + d_em[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(2.0*sf[1]*sqrt(sf[5])*sqrt(sf[9]))) + mu_Gex[7]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_spn(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of g -*/ -double obj_alk_g(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_g(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0] - x[1] + 1.0; - sf[1] = -x[0]*x[1] + x[0]; - sf[2] = x[1]; - sf[3] = -x[2] - x[3] - 2.0*x[4] + 1.0; - sf[4] = x[3]; - sf[5] = x[2]; - sf[6] = x[4]; - sf[7] = x[4]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[1], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[5], 2.0) + d_em[3])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[4], 2.0) + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(8.0*cpow(sf[0], 3.0)*sf[3]*sqrt(sf[6])*sqrt(sf[7]))) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_g(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ol -*/ -double obj_alk_ol(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_ol(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -x[0] + x[2] + 1.0; - sf[1] = x[0] - x[2]; - sf[2] = x[0]*x[1] - x[0] - x[1] - x[2] + 1.0; - sf[3] = -x[0]*x[1] + x[0] + x[2]; - sf[4] = x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[4])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[3])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sf[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*sf[3])) + mu_Gex[3]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_ol(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of opx -*/ -double obj_alk_opx(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_opx(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0]*x[5] + x[0]*x[7] - x[0] + x[1]*x[3] - x[1] - x[3]*x[5] + x[3]*x[7] - x[3] + x[5] - x[7] + 1.0; - sf[1] = -x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]; - sf[2] = x[1] - x[4] - 2.0*x[5] - x[6] + x[7]; - sf[3] = x[4]; - sf[4] = x[6]; - sf[5] = x[5]; - sf[6] = x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] - x[2] + x[3]*x[5] - x[3]*x[7] + x[3] - x[7] + 1.0; - sf[7] = -x[0]*x[2] - x[0]*x[7] + x[0] + x[1]*x[3] - x[3]*x[5] + x[3]*x[7] - x[3]; - sf[8] = x[2]; - sf[9] = x[7]; - sf[10] = 1.0 - 0.5*x[1]; - sf[11] = 0.5*x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[6])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sqrt(sf[10])*sf[1]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[8])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[2]*sf[6])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[4]*sf[6] + d_em[5])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sqrt(sf[5])*sf[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[3]*sf[6] + d_em[7])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sqrt(sf[10])*sf[2]*sf[9])) + mu_Gex[8]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_opx(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of cpx -*/ -double obj_alk_cpx(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_cpx(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + x[1]*x[4] - x[1] + x[3]*x[4] - x[3] - x[4]*x[7] + x[4]*x[8] - x[4] + x[7] - x[8] + 1.0; - sf[1] = -x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - sf[2] = x[1] + x[3] - x[5] - x[6] - 2.0*x[7] + x[8]; - sf[3] = x[5]; - sf[4] = x[6]; - sf[5] = x[7]; - sf[6] = -x[0]*x[2] - x[1]*x[4] + x[2] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - sf[7] = x[0]*x[2] + x[1]*x[4] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]; - sf[8] = -x[2] - x[3] - x[8] + 1.0; - sf[9] = x[3]; - sf[10] = x[8]; - sf[11] = 1.0 - 0.5*x[1]; - sf[12] = 0.5*x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[8])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sqrt(sf[11])*sf[1]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[2]*sf[8])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[4]*sf[8] + d_em[3])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[3]*sf[8] + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sqrt(sf[5])*sf[8])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sqrt(sf[11])*sf[2]*sf[9])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[6])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[7])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(sf[10]*sqrt(sf[11])*sf[2])) + mu_Gex[9]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_cpx(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ilm -*/ -double obj_alk_ilm(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_ilm(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -0.5*x[0]*x[1] + 0.5*x[0] + 0.5*x[2]; - sf[1] = 0.5*x[0] - 0.5*x[3]; - sf[2] = 1.0 - x[0]; - sf[3] = 0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]; - sf[4] = -0.5*x[0]*x[1] + 0.5*x[0] - 0.5*x[2]; - sf[5] = 0.5*x[0] + 0.5*x[3]; - sf[6] = 1.0 - x[0]; - sf[7] = 0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(sqrt(sf[0])*sqrt(sf[5]))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*cpow(sf[0], 0.25)*cpow(sf[1], 0.25)*cpow(sf[4], 0.25)*cpow(sf[5], 0.25))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sqrt(sf[2])*sqrt(sf[6]) + d_em[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sqrt(sf[3])*sqrt(sf[5]))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(2.0*cpow(sf[1], 0.25)*cpow(sf[3], 0.25)*cpow(sf[5], 0.25)*cpow(sf[7], 0.25))) + mu_Gex[4]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_ilm(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ness -*/ -double obj_alk_ness(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_ness(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = 0.25*x[0]*x[1] + 0.75*x[1]*x[4] - x[1] + 0.25*x[2] - x[4] + 1.0; - sf[1] = -0.25*x[0]*x[1] - 0.75*x[1]*x[4] + x[1] - 0.25*x[2]; - sf[2] = x[4]; - sf[3] = 0.25*x[0]*x[1] - x[0] + 0.75*x[1]*x[4] - x[1] - 0.75*x[2] + 1.0; - sf[4] = -0.25*x[0]*x[1] - 0.75*x[1]*x[4] + x[1] + 0.75*x[2]; - sf[5] = x[0]; - sf[6] = -0.25*x[0] - x[3] + 0.75*x[4] + 1.0; - sf[7] = 0.25*x[0] - 0.75*x[4]; - sf[8] = x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[0], 3.0)*sf[3]*cpow(sf[6], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(3.0792*cpow(sf[0], 3.0)*sf[5]*cpow(sf[6], 1.5)*sqrt(sf[7]))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[1], 3.0)*sf[4]*cpow(sf[6], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[0], 3.0)*sf[4]*cpow(sf[6], 2.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(6.75*cpow(sf[0], 2.0)*sf[2]*sf[5]*cpow(sf[6], 2.0))) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(cpow(sf[0], 3.0)*sf[3]*cpow(sf[8], 2.0) + d_em[5])) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_ness(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of lct -*/ -double obj_alk_lct(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_lct(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]; - sf[1] = 1.0 - x[0]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1])) + mu_Gex[1]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_lct(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of kals -*/ -double obj_alk_kals(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_kals(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]; - sf[1] = 1.0 - x[0]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[1])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[0])) + mu_Gex[1]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_kals(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of mel -*/ -double obj_alk_mel(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_mel(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[1]; - sf[1] = 1.0 - x[1]; - sf[2] = x[0]*x[2] + x[0]*x[3] - x[0] - x[2] - x[3] + 1.0; - sf[3] = -x[0]*x[2] - x[0]*x[3] + x[0]; - sf[4] = x[2]; - sf[5] = x[3]; - sf[6] = -x[1] + 0.5*x[2] + 0.5*x[3]; - sf[7] = x[1] - 0.5*x[2] - 0.5*x[3] + 1.0; - - - mu[0] = gb[0] + R*T*creal(clog(2.0*cpow(sf[1], 2.0)*sf[4]*sqrt(sf[6])*sqrt(sf[7]))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[2]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[3]*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(4.0*sf[0]*sf[1]*sf[4]*sf[7])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(2.0*cpow(sf[1], 2.0)*sf[5]*sqrt(sf[6])*sqrt(sf[7]) + d_em[4])) + mu_Gex[4]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_mel(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of hb -*/ -double obj_alk_hb(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_hb(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = 1.0 - x[3]; - sf[1] = -x[3]*x[4] + x[3]; - sf[2] = x[3]*x[4]; - sf[3] = -x[0] + x[8] + 1.0; - sf[4] = x[0] - x[8]; - sf[5] = x[0]*x[1] + x[0]*x[6] + x[0]*x[7] - x[0] - x[1]*x[9] - x[1] - x[6]*x[9] - x[6] - x[7]*x[9] - x[7] + x[9] + 1.0; - sf[6] = -x[0]*x[1] - x[0]*x[6] - x[0]*x[7] + x[0] + x[1]*x[9] + x[6]*x[9] + x[7]*x[9] - x[9]; - sf[7] = x[1]; - sf[8] = x[6]; - sf[9] = x[7]; - sf[10] = x[5]; - sf[11] = x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] - x[2] - x[5] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9] + 1.0; - sf[12] = -x[0]*x[2] - x[0]*x[5] + x[0] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + 1.5*x[8] + x[9]; - sf[13] = x[2]; - sf[14] = -0.5*x[1] + 0.5*x[2] - 0.25*x[3] - 0.5*x[6] - 0.5*x[7] + 1.0; - sf[15] = 0.5*x[1] - 0.5*x[2] + 0.25*x[3] + 0.5*x[6] + 0.5*x[7]; - sf[16] = 1.0 - x[7]; - sf[17] = x[7]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*cpow(sf[10], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[7], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[1]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*cpow(sf[13], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[7], 2.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[0]*cpow(sf[11], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[4], 3.0)*cpow(sf[6], 2.0))) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[6], 2.0))) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[4], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sf[0]*cpow(sf[13], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[8], 2.0) + d_em[8])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[2]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[9]; - mu[10] = gb[10] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[17], 2.0)*cpow(sf[3], 3.0)*cpow(sf[9], 2.0))) + mu_Gex[10]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_hb(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of bi -*/ -double obj_alk_bi(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_bi(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - x[1] - x[2] - x[3] - 2.0/3.0*x[4] + 1.0; - sf[1] = -x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[0] + 2.0/3.0*x[4]; - sf[2] = x[2]; - sf[3] = x[3]; - sf[4] = x[1]; - sf[5] = -x[0] + 1.0/3.0*x[4] + 1.0; - sf[6] = x[0] - 1.0/3.0*x[4]; - sf[7] = -0.5*x[1] - 0.5*x[2] + 0.5; - sf[8] = 0.5*x[1] + 0.5*x[2] + 0.5; - sf[9] = 1.0 - x[3]; - sf[10] = x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(4.0*sf[0]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(4.0*sf[1]*cpow(sf[6], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(4.0*sf[1]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[4]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(4.0*cpow(sf[10], 2.0)*sf[3]*cpow(sf[5], 2.0)*sf[7]*sf[8])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(sf[2]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0) + d_em[5])) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_bi(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ep -*/ -double obj_alk_ep(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_alk_ep(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0] - x[1]; - sf[1] = -x[0] + x[1] + 1.0; - sf[2] = x[0] + x[1]; - sf[3] = -x[0] - x[1] + 1.0; - - mu[0] = gb[0] + R*T*creal(clog(sf[1]*sf[3])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[2] + d_em[1])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sf[2] + d_em[2])) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_ep(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of cd -*/ -double obj_alk_cd(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_alk_cd(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0]; - sf[1] = 1.0 - x[0]; - sf[2] = x[1]; - sf[3] = 1.0 - x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[3])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[0], 2.0)*sf[3])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[2])) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_alk_cd(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -/**************************************************************************************/ -/**************************************************************************************/ -/*********************IGNEOUS DRY DATABASE (Green et al., 2023)************************/ -/**************************************************************************************/ -/**************************************************************************************/ - -
    [docs]/** - Update dpdx matrix of liq -*/ -void dpdx_igd_liq(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][1] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][2] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][3] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][4] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][5] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][6] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][7] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][8] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][9] = - x[10] - 2./3.*x[11] + 1./6.*x[12] - 1./3.*x[13] - 1.0; dp_dx[0][10] = - x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; dp_dx[0][11] = -2./3.*x[0] - 2./3.*x[1] - 2./3.*x[2] - 2./3.*x[3] - 2./3.*x[4] - 2./3.*x[5] - 2./3.*x[6] - 2./3.*x[7] - 2./3.*x[8] - 2./3.*x[9]; dp_dx[0][12] = 1./6.*x[0] + 1./6.*x[1] + 1./6.*x[2] + 1./6.*x[3] + 1./6.*x[4] + 1./6.*x[5] + 1./6.*x[6] + 1./6.*x[7] + 1./6.*x[8] + 1./6.*x[9] - 0.5; dp_dx[0][13] = -1./3.*x[0] - 1./3.*x[1] - 1./3.*x[2] - 1./3.*x[3] - 1./3.*x[4] - 1./3.*x[5] - 1./3.*x[6] - 1./3.*x[7] - 1./3.*x[8] - 1./3.*x[9]; - dp_dx[1][0] = 0.0; dp_dx[1][1] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 0.0; dp_dx[1][10] = x[1] - 1.0; dp_dx[1][11] = 2./3.*x[1]; dp_dx[1][12] = -1./6.*x[1]; dp_dx[1][13] = 1./3.*x[1]; - dp_dx[2][0] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 0.0; dp_dx[2][10] = x[0] - 1.0; dp_dx[2][11] = 2./3.*x[0]; dp_dx[2][12] = -1./6.*x[0]; dp_dx[2][13] = 1./3.*x[0]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 0.0; dp_dx[3][10] = x[2]; dp_dx[3][11] = 2./3.*x[2]; dp_dx[3][12] = -1./6.*x[2] - 0.5; dp_dx[3][13] = 1./3.*x[2]; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; dp_dx[4][9] = 0.0; dp_dx[4][10] = x[3]; dp_dx[4][11] = 2./3.*x[3]; dp_dx[4][12] = -1./6.*x[3]; dp_dx[4][13] = 1./3.*x[3]; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 0.0; dp_dx[5][8] = 0.0; dp_dx[5][9] = 0.0; dp_dx[5][10] = x[4]; dp_dx[5][11] = 2./3.*x[4] - 1.0; dp_dx[5][12] = -1./6.*x[4]; dp_dx[5][13] = 1./3.*x[4]; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; dp_dx[6][9] = 0.0; dp_dx[6][10] = x[5]; dp_dx[6][11] = 2./3.*x[5]; dp_dx[6][12] = -1./6.*x[5]; dp_dx[6][13] = 1./3.*x[5]; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[7][7] = 0.0; dp_dx[7][8] = 0.0; dp_dx[7][9] = 0.0; dp_dx[7][10] = x[6]; dp_dx[7][11] = 2./3.*x[6]; dp_dx[7][12] = -1./6.*x[6]; dp_dx[7][13] = 1./3.*x[6]; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 0.0; dp_dx[8][10] = x[7]; dp_dx[8][11] = 2./3.*x[7]; dp_dx[8][12] = -1./6.*x[7]; dp_dx[8][13] = 1./3.*x[7]; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[9][9] = 0.0; dp_dx[9][10] = x[8]; dp_dx[9][11] = 2./3.*x[8]; dp_dx[9][12] = -1./6.*x[8]; dp_dx[9][13] = 1./3.*x[8] - 1.0; - dp_dx[10][0] = 0.0; dp_dx[10][1] = 0.0; dp_dx[10][2] = 0.0; dp_dx[10][3] = 0.0; dp_dx[10][4] = 0.0; dp_dx[10][5] = 0.0; dp_dx[10][6] = 0.0; dp_dx[10][7] = 0.0; dp_dx[10][8] = 0.0; dp_dx[10][9] = 0.0; dp_dx[10][10] = 1.0; dp_dx[10][11] = 0.0; dp_dx[10][12] = 0.0; dp_dx[10][13] = 0.0; - dp_dx[11][0] = 0.0; dp_dx[11][1] = 0.0; dp_dx[11][2] = 0.0; dp_dx[11][3] = 0.0; dp_dx[11][4] = 0.0; dp_dx[11][5] = 0.0; dp_dx[11][6] = 0.0; dp_dx[11][7] = 0.0; dp_dx[11][8] = 0.0; dp_dx[11][9] = 0.0; dp_dx[11][10] = 0.0; dp_dx[11][11] = 1.0; dp_dx[11][12] = 0.0; dp_dx[11][13] = 0.0; - dp_dx[12][0] = 0.0; dp_dx[12][1] = 0.0; dp_dx[12][2] = 0.0; dp_dx[12][3] = 0.0; dp_dx[12][4] = 0.0; dp_dx[12][5] = 0.0; dp_dx[12][6] = 0.0; dp_dx[12][7] = 0.0; dp_dx[12][8] = 0.0; dp_dx[12][9] = 0.0; dp_dx[12][10] = 0.0; dp_dx[12][11] = 0.0; dp_dx[12][12] = 1.0; dp_dx[12][13] = 0.0; - dp_dx[13][0] = 0.0; dp_dx[13][1] = 0.0; dp_dx[13][2] = 0.0; dp_dx[13][3] = 0.0; dp_dx[13][4] = 0.0; dp_dx[13][5] = 0.0; dp_dx[13][6] = 0.0; dp_dx[13][7] = 0.0; dp_dx[13][8] = 0.0; dp_dx[13][9] = 0.0; dp_dx[13][10] = 0.0; dp_dx[13][11] = 0.0; dp_dx[13][12] = 0.0; dp_dx[13][13] = 1.0; - dp_dx[14][0] = 0.0; dp_dx[14][1] = 0.0; dp_dx[14][2] = 0.0; dp_dx[14][3] = 0.0; dp_dx[14][4] = 0.0; dp_dx[14][5] = 0.0; dp_dx[14][6] = 0.0; dp_dx[14][7] = 0.0; dp_dx[14][8] = 0.0; dp_dx[14][9] = x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0; dp_dx[14][10] = x[9]; dp_dx[14][11] = 2./3.*x[9]; dp_dx[14][12] = -1./6.*x[9]; dp_dx[14][13] = 1./3.*x[9]; -}
    - - -
    [docs]/** - Update dpdx matrix of fl -*/ -void dpdx_igd_fl(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; dp_dx[0][2] = -1.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; dp_dx[2][2] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of fsp -*/ -void dpdx_igd_fsp(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of spn -*/ -void dpdx_igd_spn(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1./3.*x[3] - 1./3.; dp_dx[0][1] = 0.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = 1./3. - 1./3.*x[0]; dp_dx[0][4] = 2./3.; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; - dp_dx[1][0] = -2./3.*x[3] - 2./3.; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 2./3. - 2./3.*x[0]; dp_dx[1][4] = -2./3.; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; - dp_dx[2][0] = 1./3.*x[3] + 1./3.; dp_dx[2][1] = 1./3.*x[2] + 1./3.*x[3] - 1./3.; dp_dx[2][2] = 1./3.*x[1]; dp_dx[2][3] = 1./3.*x[0] + 1./3.*x[1] - 1.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 2./3.; dp_dx[2][6] = 2./3.; - dp_dx[3][0] = 2./3.*x[3] + 2./3.; dp_dx[3][1] = 2./3.*x[2] + 2./3.*x[3] - 2./3.; dp_dx[3][2] = 2./3.*x[1]; dp_dx[3][3] = 2./3.*x[0] + 2./3.*x[1] - 1.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = -2./3.; dp_dx[3][6] = -2./3.; - dp_dx[4][0] = 0.0; dp_dx[4][1] = -1./3.*x[2] - 1./3.*x[3] + 1./3.; dp_dx[4][2] = -1./3.*x[1]; dp_dx[4][3] = -1./3.*x[1]; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = -2./3.; - dp_dx[5][0] = 0.0; dp_dx[5][1] = -2./3.*x[2] - 2./3.*x[3] + 2./3.; dp_dx[5][2] = -2./3.*x[1]; dp_dx[5][3] = -2./3.*x[1]; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 2./3.; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 1.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; dp_dx[6][6] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 1.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of g -*/ -void dpdx_igd_g(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = 0.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -4.0; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = - x[0]; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; dp_dx[2][2] = -1.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; dp_dx[4][4] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 4.0; -}
    - - -
    [docs]/** - Update dpdx matrix of ol -*/ -void dpdx_igd_ol(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = 0.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = -1.0; - dp_dx[2][0] = x[1] - 1.0; dp_dx[2][1] = x[0] - 1.0; dp_dx[2][2] = -1.0; - dp_dx[3][0] = - x[1]; dp_dx[3][1] = - x[0]; dp_dx[3][2] = 2.0; -}
    - - -
    [docs]/** - Update dpdx matrix of opx -*/ -void dpdx_igd_opx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[2] + x[7] - 1.0; dp_dx[0][1] = - x[3] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = - x[1] + x[5] - x[7] + 1.0; dp_dx[0][4] = 0.0; dp_dx[0][5] = x[3]; dp_dx[0][6] = 0.0; dp_dx[0][7] = x[0] - x[3] - 1.0; - dp_dx[1][0] = - x[1] + x[5] - x[7] + 1.0; dp_dx[1][1] = - x[0] - x[3]; dp_dx[1][2] = 0.0; dp_dx[1][3] = - x[1] + x[5] - x[7] + 1.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = x[0] + x[3]; dp_dx[1][6] = 0.0; dp_dx[1][7] = - x[0] - x[3]; - dp_dx[2][0] = x[1] - x[2] - x[5]; dp_dx[2][1] = x[0] + 2.0*x[3]; dp_dx[2][2] = - x[0]; dp_dx[2][3] = 2.0*x[1] - 2.0*x[5] + 2.0*x[7] - 2.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = - x[0] - 2.0*x[3]; dp_dx[2][6] = 0.0; dp_dx[2][7] = 2.0*x[3]; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 1.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = -1.0; dp_dx[4][5] = -2.0; dp_dx[4][6] = -1.0; dp_dx[4][7] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 1.0; dp_dx[5][7] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 2.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 1.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; dp_dx[7][7] = 0.0; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of cpx -*/ -void dpdx_igd_cpx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = -1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = 0.0; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; dp_dx[0][7] = 0.0; dp_dx[0][8] = -1.0; - dp_dx[1][0] = - x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[1][1] = - x[0] - x[4]; dp_dx[1][2] = 0.0; dp_dx[1][3] = - x[0] - x[4]; dp_dx[1][4] = - x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = x[0] + x[4]; dp_dx[1][8] = - x[0] - x[4]; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = -1.0; dp_dx[2][6] = -1.0; dp_dx[2][7] = -2.0; dp_dx[2][8] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 1.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 1.0; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 2.0; dp_dx[5][8] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 1.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; - dp_dx[7][0] = - x[2]; dp_dx[7][1] = - x[4]; dp_dx[7][2] = 1.0 - x[0]; dp_dx[7][3] = - x[4]; dp_dx[7][4] = - x[1] - x[3] + x[7] - x[8] + 1.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.0; dp_dx[7][7] = x[4]; dp_dx[7][8] = - x[4]; - dp_dx[8][0] = x[1] + x[2] + x[3] - x[7] + x[8] - 1.0; dp_dx[8][1] = x[0] + 2.0*x[4]; dp_dx[8][2] = x[0]; dp_dx[8][3] = x[0] + 2.0*x[4]; dp_dx[8][4] = 2.0*x[1] + 2.0*x[3] - 2.0*x[7] + 2.0*x[8] - 2.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = - x[0] - 2.0*x[4]; dp_dx[8][8] = x[0] + 2.0*x[4]; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of ilm -*/ -void dpdx_igd_ilm(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = 1.0; dp_dx[0][3] = 0.0; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = - x[0]; dp_dx[1][2] = -1.0; dp_dx[1][3] = 0.0; - dp_dx[2][0] = -1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = -1.0; dp_dx[3][3] = 1.0; - dp_dx[4][0] = x[1]; dp_dx[4][1] = x[0]; dp_dx[4][2] = 1.0; dp_dx[4][3] = -1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of hb -*/ -void dpdx_igd_hb(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = -1.0; dp_dx[0][2] = 1.0; dp_dx[0][3] = -0.50; dp_dx[0][4] = 0.0; dp_dx[0][5] = 1.0; dp_dx[0][6] = -1.0; dp_dx[0][7] = -1.0; dp_dx[0][8] = 0.0; dp_dx[0][9] = 0.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 1.0; dp_dx[1][2] = -1.0; dp_dx[1][3] = -0.50; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 1.0; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 1.0 - x[4]; dp_dx[2][4] = - x[3]; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = -1.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 0.0; - dp_dx[4][0] = x[2] + x[5] - 1.0; dp_dx[4][1] = x[9]; dp_dx[4][2] = x[0] - 1.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = x[0] - 1.0; dp_dx[4][6] = x[9]; dp_dx[4][7] = x[9]; dp_dx[4][8] = -1.5; dp_dx[4][9] = x[1] + x[6] + x[7] - 1.0; - dp_dx[5][0] = - x[1] + x[2] + x[5] - x[6] - x[7] + 1.0; dp_dx[5][1] = - x[0] + 2.0*x[9]; dp_dx[5][2] = x[0]; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = x[0]; dp_dx[5][6] = - x[0] + 2.0*x[9]; dp_dx[5][7] = - x[0] + 2.0*x[9]; dp_dx[5][8] = -2.5; dp_dx[5][9] = 2.0*x[1] + 2.0*x[6] + 2.0*x[7] - 2.0; - dp_dx[6][0] = - x[2] - x[5]; dp_dx[6][1] = - x[9]; dp_dx[6][2] = - x[0]; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = - x[0]; dp_dx[6][6] = - x[9]; dp_dx[6][7] = - x[9]; dp_dx[6][8] = 2.5; dp_dx[6][9] = - x[1] - x[6] - x[7] + 1.0; - dp_dx[7][0] = x[1] - x[2] - x[5] + x[6] + x[7]; dp_dx[7][1] = x[0] - 2.0*x[9]; dp_dx[7][2] = - x[0]; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = - x[0]; dp_dx[7][6] = x[0] - 2.0*x[9]; dp_dx[7][7] = x[0] - 2.0*x[9]; dp_dx[7][8] = 1.5; dp_dx[7][9] = -2.0*x[1] - 2.0*x[6] - 2.0*x[7] + 2.0; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 1.0; dp_dx[8][7] = 0.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 0.0; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = x[4]; dp_dx[9][4] = x[3]; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 0.0; dp_dx[9][9] = 0.0; - dp_dx[10][0] = 0.0; dp_dx[10][1] = 0.0; dp_dx[10][2] = 0.0; dp_dx[10][3] = 0.0; dp_dx[10][4] = 0.0; dp_dx[10][5] = 0.0; dp_dx[10][6] = 0.0; dp_dx[10][7] = 1.0; dp_dx[10][8] = 0.0; dp_dx[10][9] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of bi -*/ -void dpdx_igd_bi(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[1] + x[2] + x[3] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = x[0] - 1.0; dp_dx[0][4] = -2./3.; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = -1./3.; - dp_dx[2][0] = - x[1] - x[2] - x[3]; dp_dx[2][1] = - x[0]; dp_dx[2][2] = - x[0]; dp_dx[2][3] = - x[0]; dp_dx[2][4] = 1.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; dp_dx[4][4] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; -}
    - - -
    [docs]/** - Update dpdx matrix of ep -*/ -void dpdx_igd_ep(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 2.0; - dp_dx[2][0] = 1.0; dp_dx[2][1] = -1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of cd -*/ -void dpdx_igd_cd(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; -}
    - - -
    [docs]/** - Endmember fraction of liq -*/ -void px_igd_liq(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[0] + x[10]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) + 2./3.*x[11]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) + 1./6.*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) + 1./3.*x[13]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; - p[1] = x[10]*x[1] - x[10] + 2./3.*x[11]*x[1] - 1./6.*x[12]*x[1] + 1./3.*x[13]*x[1] + x[1]; - p[2] = x[0]*x[10] + 2./3.*x[0]*x[11] - 1./6.*x[0]*x[12] + 1./3.*x[0]*x[13] + x[0] - x[10]; - p[3] = x[10]*x[2] + 2./3.*x[11]*x[2] - 1./6.*x[12]*x[2] - 0.5*x[12] + 1./3.*x[13]*x[2] + x[2]; - p[4] = x[10]*x[3] + 2./3.*x[11]*x[3] - 1./6.*x[12]*x[3] + 1./3.*x[13]*x[3] + x[3]; - p[5] = x[10]*x[4] + 2./3.*x[11]*x[4] - x[11] - 1./6.*x[12]*x[4] + 1./3.*x[13]*x[4] + x[4]; - p[6] = x[10]*x[5] + 2./3.*x[11]*x[5] - 1./6.*x[12]*x[5] + 1./3.*x[13]*x[5] + x[5]; - p[7] = x[10]*x[6] + 2./3.*x[11]*x[6] - 1./6.*x[12]*x[6] + 1./3.*x[13]*x[6] + x[6]; - p[8] = x[10]*x[7] + 2./3.*x[11]*x[7] - 1./6.*x[12]*x[7] + 1./3.*x[13]*x[7] + x[7]; - p[9] = x[10]*x[8] + 2./3.*x[11]*x[8] - 1./6.*x[12]*x[8] + 1./3.*x[13]*x[8] - x[13] + x[8]; - p[10] = x[10]; - p[11] = x[11]; - p[12] = x[12]; - p[13] = x[13]; - p[14] = x[10]*x[9] + 2./3.*x[11]*x[9] - 1./6.*x[12]*x[9] + 1./3.*x[13]*x[9] + x[9]; -}
    - - -
    [docs]/** - Endmember fraction of fl -*/ -void px_igd_fl(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[0] - x[1] - x[2] + 1.0; - p[1] = x[0]; - p[2] = x[1]; - p[3] = x[2]; -}
    - - -
    [docs]/** - Endmember fraction of fsp -*/ -void px_igd_fsp(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[0] - x[1] + 1.0; - p[1] = x[0]; - p[2] = x[1]; -}
    - - -
    [docs]/** - Endmember fraction of spn -*/ -void px_igd_spn(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = -1./3.*x[0]*x[3] - 1./3.*x[0] - x[2] + 1./3.*x[3] + 2./3.*x[4] + 1./3.; - p[1] = -2./3.*x[0]*x[3] - 2./3.*x[0] + 2./3.*x[3] - 2./3.*x[4] + 2./3.; - p[2] = 1./3.*x[0]*x[3] + 1./3.*x[0] + 1./3.*x[1]*x[2] + 1./3.*x[1]*x[3] - 1./3.*x[1] - x[3] + 2./3.*x[5] + 2./3.*x[6]; - p[3] = 2./3.*x[0]*x[3] + 2./3.*x[0] + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] - x[3] - 2./3.*x[5] - 2./3.*x[6]; - p[4] = -1./3.*x[1]*x[2] - 1./3.*x[1]*x[3] + 1./3.*x[1] - 2./3.*x[6]; - p[5] = -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + 2./3.*x[6]; - p[6] = x[2]; - p[7] = x[3]; -}
    - - -
    [docs]/** - Endmember fraction of g -*/ -void px_igd_g(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[1] - x[0] - x[1] - x[3] - 4.0*x[4] + 1.0; - p[1] = - x[0]*x[1] + x[0]; - p[2] = x[1] - x[2]; - p[3] = x[2]; - p[4] = x[3]; - p[5] = 4.0*x[4]; -}
    - - -
    [docs]/** - Endmember fraction of ol -*/ -void px_igd_ol(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[1]; - p[1] = x[0] - x[2]; - p[2] = x[0]*x[1] - x[0] - x[1] - x[2] + 1.0; - p[3] = - x[0]*x[1] + 2.0*x[2]; -}
    - - -
    [docs]/** - Endmember fraction of opx -*/ -void px_igd_opx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] - x[1] - x[2] + x[3]*x[5] - x[3]*x[7] + x[3] - x[7] + 1.0; - p[1] = - x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]; - p[2] = x[0]*x[1] - x[0]*x[2] - x[0]*x[5] + 2.0*x[1]*x[3] - 2.0*x[3]*x[5] + 2.0*x[3]*x[7] - 2.0*x[3]; - p[3] = x[2]; - p[4] = x[1] - x[4] - 2.0*x[5] - x[6]; - p[5] = x[6]; - p[6] = 2.0*x[5]; - p[7] = x[4]; - p[8] = x[7]; -}
    - - -
    [docs]/** - Endmember fraction of cpx -*/ -void px_igd_cpx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[1] - x[2] - x[3] - x[8] + 1.0; - p[1] = - x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - p[2] = x[1] - x[5] - x[6] - 2.0*x[7]; - p[3] = x[6]; - p[4] = x[5]; - p[5] = 2.0*x[7]; - p[6] = x[3]; - p[7] = - x[0]*x[2] - x[1]*x[4] + x[2] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - p[8] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + 2.0*x[1]*x[4] + 2.0*x[3]*x[4] - 2.0*x[4]*x[7] + 2.0*x[4]*x[8] - 2.0*x[4]; - p[9] = x[8]; -}
    - - -
    [docs]/** - Endmember fraction of ilm -*/ -void px_igd_ilm(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[2]; - p[1] = - x[0]*x[1] + x[0] - x[2]; - p[2] = 1.0 - x[0]; - p[3] = - x[2] + x[3]; - p[4] = x[0]*x[1] + x[2] - x[3]; -}
    - - -
    [docs]/** - Endmember fraction of hb -*/ -void px_igd_hb(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[1] + x[2] - 0.5*x[3] + x[5] - x[6] - x[7]; - p[1] = x[1] - x[2] - 0.5*x[3] + x[6]; - p[2] = - x[3]*x[4] + x[3]; - p[3] = x[2] - x[6]; - p[4] = x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] - x[2] - x[5] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9] + 1.0; - p[5] = - x[0]*x[1] + x[0]*x[2] + x[0]*x[5] - x[0]*x[6] - x[0]*x[7] + x[0] + 2.0*x[1]*x[9] + 2.0*x[6]*x[9] + 2.0*x[7]*x[9] - 2.5*x[8] - 2.0*x[9]; - p[6] = - x[0]*x[2] - x[0]*x[5] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + 2.5*x[8] + x[9]; - p[7] = x[0]*x[1] - x[0]*x[2] - x[0]*x[5] + x[0]*x[6] + x[0]*x[7] - 2.0*x[1]*x[9] - 2.0*x[6]*x[9] - 2.0*x[7]*x[9] + 1.5*x[8] + 2.0*x[9]; - p[8] = x[6]; - p[9] = x[3]*x[4]; - p[10] = x[7]; -}
    - - -
    [docs]/** - Endmember fraction of bi -*/ -void px_igd_bi(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - x[1] - x[2] - x[3] - 2./3.*x[4] + 1.0; - p[1] = x[0] - 1./3.*x[4]; - p[2] = - x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[4]; - p[3] = x[1]; - p[4] = x[3]; - p[5] = x[2]; -}
    - - -
    [docs]/** - Endmember fraction of ep -*/ -void px_igd_ep(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[0] - x[1] + 1.0; - p[1] = 2.0*x[1]; - p[2] = x[0] - x[1]; -}
    - - -
    [docs]/** - Endmember fraction of cd -*/ -void px_igd_cd(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[0] - x[1] + 1.0; - p[1] = x[0]; - p[2] = x[1]; -}
    - - - - -
    [docs]/** - endmembers to xeos (biotite) -*/ -void p2x_igd_bi(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (d->p[0]-2.0*d->p[1]+d->p[5]+d->p[4]+d->p[3] -1.0)/(d->p[3]+d->p[4]+d->p[5]-3.0); - d->iguess[1] = d->p[3]; - d->iguess[2] = d->p[5]; - d->iguess[3] = d->p[4]; - d->iguess[4] = 3.0*( (d->p[0]-2.0*d->p[1]+d->p[5]+d->p[4]+d->p[3] -1.0)/(d->p[3]+d->p[4]+d->p[5]-3.0) -d->p[1]); - - - if (d->z_em[4] == 0.0){ d->iguess[3] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[2] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (cordierite) -*/ -void p2x_igd_cd(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - d->iguess[1] = d->p[2]; - - if (d->z_em[2] == 0.0){ d->iguess[1] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (clinopyroxene) -*/ -void p2x_igd_cpx(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1] + d->p[8])/(d->p[1] - d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] + d->p[7] + d->p[8] - d->p[9] + 1.0); - d->iguess[1] = d->p[2] + d->p[3] + d->p[4] + d->p[5]; - d->iguess[2] = d->p[1]+d->p[7]+d->p[8]; - d->iguess[3] = d->p[6]; - d->iguess[4] = (d->p[7] + ((2.0*d->p[1] + d->p[8])/(d->p[1] - d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] + d->p[7] + d->p[8] - d->p[9] + 1.0) - 1.0)*(d->p[1] + d->p[7] + d->p[8]))/(-d->p[2] - d->p[3] - d->p[4] - 0.5*d->p[5] - d->p[6] - d->p[9] + 1.0); - d->iguess[5] = d->p[4]; - d->iguess[6] = d->p[3]; - d->iguess[7] = d->p[5]/2.0; - d->iguess[8] = d->p[9]; - - if (d->z_em[3] == 0.0){ d->iguess[6] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[5] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[7] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (epidote) -*/ -void p2x_igd_ep(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[2] + d->p[1]/2.0; - d->iguess[1] = d->p[1]/2.0; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (fluid) -*/ -void p2x_igd_fl(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - d->iguess[1] = d->p[2]; - d->iguess[2] = d->p[3]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (garnet) -*/ -void p2x_igd_g(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (d->p[0]+d->p[4]+d->p[5]+d->p[2]+d->p[3]-1.0)/(-1.0+d->p[2]+d->p[3]); - d->iguess[1] = d->p[2]+d->p[3]; - d->iguess[2] = d->p[3]; - d->iguess[3] = d->p[4]; - d->iguess[4] = d->p[5]/4.0; - - if (d->z_em[3] == 0.0){ d->iguess[2] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[3] = eps;} - if (d->z_em[5] == 0.0){ d->iguess[4] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (hornblende) -*/ -void p2x_igd_hb(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0); - d->iguess[1] = (d->p[1]-d->p[0] + 1.0-d->p[3]-d->p[8]-d->p[4]-d->p[6]-d->p[5]-d->p[7] -2*d->p[8] - d->p[10] + 2*(d->p[3] + d->p[8]))/2.0; - d->iguess[2] = d->p[3] + d->p[8]; - d->iguess[3] = d->p[2] + d->p[9]; - d->iguess[4] = d->p[9]/(d->p[2]+d->p[9]); - d->iguess[5] = 1.0-d->p[3]-d->p[8]-d->p[4]-d->p[6]-d->p[5]-d->p[7]; - d->iguess[6] = d->p[8]; - d->iguess[7] = d->p[10]; - d->iguess[8] = (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0) -d->p[5] -d->p[7]; - d->iguess[9] = (d->p[5] + d->p[6] - (-3.5*d->p[5] - 2.0*d->p[6] - 2.5*d->p[7])*(0.5*d->p[0] - 0.5*d->p[1] - 0.5*d->p[10] - 0.5*d->p[3] + 0.5*d->p[4] + 0.5*d->p[5] + 0.5*d->p[6] + 0.5*d->p[7] - 0.5*d->p[8] + 0.5)/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 1.5*d->p[4] - 1.5*d->p[5] - 1.5*d->p[6] - 1.5*d->p[7] + 0.5*d->p[8] - 2.0))/(-0.5*d->p[0] + 0.5*d->p[1] + 0.5*d->p[10] + 0.5*d->p[3] - 0.5*d->p[4] - 0.5*d->p[5] - 0.5*d->p[6] - 0.5*d->p[7] + 0.5*d->p[8] - 0.5); - - if (d->z_em[8] == 0){ d->iguess[6] = eps;} - if (d->z_em[10] == 0){ d->iguess[7] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (ilm) -*/ -/** DEPRECATED */ -void p2x_igd_ilm(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]+d->p[0]; - d->iguess[1] = d->p[0]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - - -
    [docs]/** - Endmember to xeos for liq -*/ -void p2x_igd_liq(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[10] = d->p[10]; - d->iguess[11] = d->p[11]; - d->iguess[12] = d->p[12]; - d->iguess[13] = d->p[13]; - d->iguess[9] = -6.*d->p[14]/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[8] = 6.*(-d->p[9] + d->iguess[13])/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[7] = -6.*d->p[8]/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[6] = -6.*d->p[7]/(4*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[5] = -6.*d->p[6]/(4*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[4] = 6.*(-d->p[5] + d->iguess[11])/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[3] = -6.*d->p[4]/(4*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[2] = 3.*(-2.*d->p[3] + d->iguess[12])/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[0] = 6.*(-d->p[2] + d->iguess[10])/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - d->iguess[1] = 6.*(-d->p[1] + d->iguess[10])/(4.*d->iguess[11] + 6.*d->iguess[10] - d->iguess[12] + 2.*d->iguess[13] - 6.); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - - - - -
    [docs]/** - endmembers to xeos (olivine) -*/ -void p2x_igd_ol(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1]+d->p[3])/(2.0-d->p[0]); - d->iguess[1] = d->p[0]; - d->iguess[2] = -d->p[0] - d->p[2] + 1.0 + (d->p[0] - 1.0)*(2.0*d->p[1] + d->p[3])/(2.0 - d->p[0]); - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (orthopyroxene) -*/ -void p2x_igd_opx(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = (2.0*d->p[1] + d->p[2])/(d->p[0] + d->p[1] + d->p[2] + 0.5*d->p[6] - d->p[8] + 1.0); - d->iguess[1] = 1.0 - d->p[3] - d->p[8] - d->p[0] - d->p[1] - d->p[2]; - d->iguess[2] = d->p[3]; - d->iguess[3] = (d->p[1] + d->p[2] + (2.0*d->p[1] + d->p[2])*(d->p[3] + d->p[8] - 1.0)/(d->p[0] + d->p[1] + d->p[2] + 0.5*d->p[6] - d->p[8] + 1.0))/(-d->p[0] - d->p[1] - d->p[2] - d->p[3] - 0.5*d->p[6]); - d->iguess[4] = d->p[7]; - d->iguess[5] = d->p[6]/2.0; - d->iguess[6] = d->p[5]; - d->iguess[7] = d->p[8]; - - if (d->z_em[5] == 0.0){ d->iguess[6] = eps;} - if (d->z_em[4] == 0.0){ d->iguess[4] = eps;} - if (d->z_em[6] == 0.0){ d->iguess[5] = eps;} - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (plagioclase) -*/ -void p2x_igd_fsp(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[1]; - d->iguess[1] = d->p[2]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - endmembers to xeos (spinel) -*/ -void p2x_igd_spn(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[2] = d->p[6]; - d->iguess[3] = d->p[7]; - d->iguess[1] = (-d->p[4] - d->p[5])/(d->iguess[2] + d->iguess[3] - 1.0); - d->iguess[0] = (-d->iguess[2] - d->p[0] - d->p[1] + d->iguess[3] + 1.0)/(d->iguess[3] + 1.0); - d->iguess[4] = -3.0*d->p[1]/2.0 - d->iguess[3]*d->iguess[0] + d->iguess[3] - d->iguess[0] + 1.0; - d->iguess[6] = d->iguess[2]*d->iguess[1] + 3.0*d->p[5]/2.0 + d->iguess[3]*d->iguess[1] - d->iguess[1]; - d->iguess[5] = -d->iguess[6] + d->iguess[2]*d->iguess[1] - 3.0*d->p[3]/2.0 + d->iguess[3]*d->iguess[0] + d->iguess[3]*d->iguess[1] - 3.0*d->iguess[3]/2.0 + d->iguess[0] - d->iguess[1]; - - for (int i = 0; i < d->n_xeos; i++){ - if (d->iguess[i] < d->bounds[i][0]){ - d->iguess[i] = d->bounds[i][0]; - } - if (d->iguess[i] > d->bounds[i][1]){ - d->iguess[i] = d->bounds[i][1]; - } - } -}
    - -
    [docs]/** - Objective function of liq -*/ -double obj_igd_liq(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_liq(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -x[0] + x[10]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0) + 2./3.*x[11]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) + 1./6.*x[12]*(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7] + x[8] + x[9] - 3.0) + 1./3.*x[13]*(- x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9]) - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0; - sf[1] = x[10]*x[1] - x[10] + 2./3.*x[11]*x[1] - 1./6.*x[12]*x[1] + 1./3.*x[13]*x[1] + x[1]; - sf[2] = x[0]*x[10] + 2./3.*x[0]*x[11] - 1./6.*x[0]*x[12] + 1./3.*x[0]*x[13] + x[0] - x[10]; - sf[3] = x[10]*x[4] + 2./3.*x[11]*x[4] - x[11] - 1./6.*x[12]*x[4] + 1./3.*x[13]*x[4] + x[4]; - sf[4] = x[10]*x[5] + 2./3.*x[11]*x[5] - 1./6.*x[12]*x[5] + 1./3.*x[13]*x[5] + x[5]; - sf[5] = x[10]*x[6] + 2./3.*x[11]*x[6] - 1./6.*x[12]*x[6] + 1./3.*x[13]*x[6] + x[6]; - sf[6] = x[10]*x[7] + 2./3.*x[11]*x[7] - 1./6.*x[12]*x[7] + 1./3.*x[13]*x[7] + x[7]; - sf[7] = x[10]*x[8] + 2./3.*x[11]*x[8] - 1./6.*x[12]*x[8] + 1./3.*x[13]*x[8] - x[13] + x[8]; - sf[8] = x[11]; - sf[9] = x[10]; - sf[10] = x[12]; - sf[11] = x[13]; - sf[12] = x[10]*(x[2] + x[3]) + 2./3.*x[11]*(x[2] + x[3]) - 1./6.*x[12]*(x[2] + x[3]) - 0.5*x[12] + 1./3.*x[13]*(x[2] + x[3]) + x[2] + x[3]; - sf[13] = -x[10]*x[9] - 2./3.*x[11]*x[9] + 1./6.*x[12]*x[9] - 1./3.*x[13]*x[9] - x[9] + 1.0; - sf[14] = x[10]*x[9] + 2./3.*x[11]*x[9] - 1./6.*x[12]*x[9] + 1./3.*x[13]*x[9] + x[9]; - sf[15] = -x[10]*x[9] - 2./3.*x[11]*x[9] + 1./6.*x[12]*x[9] - 1./3.*x[13]*x[9] - x[9] + 1.0; - sf[16] = -2.0*x[12] + 4.0*x[2]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0); - sf[17] = 4.0*x[3]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0); - sf[18] = x[0]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0) - x[10]; - sf[19] = -x[10] + x[1]*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0); - sf[20] = -2.0*x[10] - 2.0*x[12] + (x[0] + x[1] + 4.0*x[2] + 4.0*x[3])*(x[10] + 2./3.*x[11] - 1./6.*x[12] + 1./3.*x[13] + 1.0); - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[19]*sf[1]*1.0/sf[20])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[18]*1.0/sf[20]*sf[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[12]*1.0/sf[13]*cpow(sf[15], 2.0)*cpow(sf[16], 4.0)*cpow(sf[20], -4.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[12]*1.0/sf[13]*cpow(sf[15], 2.0)*cpow(sf[17], 4.0)*cpow(sf[20], -4.0))) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[3])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[4] + d_em[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[5] + d_em[7])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[6])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[7])) + mu_Gex[9]; - mu[10] = gb[10] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[9])) + mu_Gex[10]; - mu[11] = gb[11] + R*T*creal(clog(1.0/sf[13]*cpow(sf[15], 2.0)*sf[8])) + mu_Gex[11]; - mu[12] = gb[12] + R*T*creal(clog(sf[10]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[12]; - mu[13] = gb[13] + R*T*creal(clog(sf[11]*1.0/sf[13]*cpow(sf[15], 2.0))) + mu_Gex[13]; - mu[14] = gb[14] + R*T*creal(clog(cpow(sf[14], 2.0))) + mu_Gex[14]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_liq(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of fl -*/ -double obj_igd_fl(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_igd_fl(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -x[0] - x[1] - x[2] + 1.0; - sf[1] = x[0]; - sf[2] = x[1]; - sf[3] = x[2]; - sf[4] = 1.0 - x[2]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[4])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[4])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[2]*sf[4])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[3], 2.0))) + mu_Gex[3]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_fl(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of fsp -*/ -double obj_igd_fsp(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_igd_fsp(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -x[0] - x[1] + 1.0; - sf[1] = x[0]; - sf[2] = x[1]; - sf[3] = 0.25*x[0] + 0.25; - sf[4] = 0.75 - 0.25*x[0]; - - - mu[0] = gb[0] + R*T*creal(clog(1.7548*sf[0]*cpow(sf[3], 0.25)*cpow(sf[4], 0.75))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[1]*csqrt(sf[3])*csqrt(sf[4]))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.7548*sf[2]*cpow(sf[3], 0.25)*cpow(sf[4], 0.75))) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_fsp(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of spn -*/ -double obj_igd_spn(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_spn(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] + 2.0/3.0*x[4] + 1.0/3.0; - sf[1] = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] + 2.0/3.0*x[5]; - sf[2] = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - 1.0/3.0*x[3] - 2.0/3.0*x[4] - 2.0/3.0*x[5] - 2.0/3.0*x[6] + 2.0/3.0; - sf[3] = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + 2.0/3.0*x[6]; - sf[4] = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] - 1.0/3.0*x[4] + 1.0/3.0; - sf[5] = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] - 1.0/3.0*x[5]; - sf[6] = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - x[2] - 5.0/6.0*x[3] + 1.0/3.0*x[4] + 1.0/3.0*x[5] + 1.0/3.0*x[6] + 2.0/3.0; - sf[7] = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] - 1.0/3.0*x[6]; - sf[8] = x[2]; - sf[9] = 0.5*x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[6])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[4])*sqrt(sf[6]))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[1]*sf[6])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[5])*sqrt(sf[6]))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[1]*sf[7] + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(2.0*sf[3]*sqrt(sf[5])*sqrt(sf[7]) + d_em[5])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sf[0]*sf[8] + d_em[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(2.0*sf[1]*sqrt(sf[5])*sqrt(sf[9]))) + mu_Gex[7]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_spn(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of g -*/ -double obj_igd_g(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_g(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0] - x[1] + 1.0; - sf[1] = -x[0]*x[1] + x[0]; - sf[2] = x[1]; - sf[3] = -x[2] - x[3] - 2.0*x[4] + 1.0; - sf[4] = x[3]; - sf[5] = x[2]; - sf[6] = x[4]; - sf[7] = x[4]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[1], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[5], 2.0) + d_em[3])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[4], 2.0) + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(8.0*cpow(sf[0], 3.0)*sf[3]*sqrt(sf[6])*sqrt(sf[7]))) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_g(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ol -*/ -double obj_igd_ol(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_igd_ol(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -x[0] + x[2] + 1.0; - sf[1] = x[0] - x[2]; - sf[2] = x[0]*x[1] - x[0] - x[1] - x[2] + 1.0; - sf[3] = -x[0]*x[1] + x[0] + x[2]; - sf[4] = x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sf[4])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[3])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sf[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*sf[3])) + mu_Gex[3]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_ol(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of opx -*/ -double obj_igd_opx(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_opx(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0]*x[5] + x[0]*x[7] - x[0] + x[1]*x[3] - x[1] - x[3]*x[5] + x[3]*x[7] - x[3] + x[5] - x[7] + 1.0; - sf[1] = -x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]; - sf[2] = x[1] - x[4] - 2.0*x[5] - x[6] + x[7]; - sf[3] = x[4]; - sf[4] = x[6]; - sf[5] = x[5]; - sf[6] = x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] - x[2] + x[3]*x[5] - x[3]*x[7] + x[3] - x[7] + 1.0; - sf[7] = -x[0]*x[2] - x[0]*x[7] + x[0] + x[1]*x[3] - x[3]*x[5] + x[3]*x[7] - x[3]; - sf[8] = x[2]; - sf[9] = x[7]; - sf[10] = 1.0 - 0.5*x[1]; - sf[11] = 0.5*x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[6])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sqrt(sf[10])*sf[1]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[8])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[2]*sf[6])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[4]*sf[6] + d_em[5])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sqrt(sf[5])*sf[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[3]*sf[6] + d_em[7])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sqrt(sf[10])*sf[2]*sf[9])) + mu_Gex[8]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_opx(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of cpx -*/ -double obj_igd_cpx(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_cpx(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + x[1]*x[4] - x[1] + x[3]*x[4] - x[3] - x[4]*x[7] + x[4]*x[8] - x[4] + x[7] - x[8] + 1.0; - sf[1] = -x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - sf[2] = x[1] + x[3] - x[5] - x[6] - 2.0*x[7] + x[8]; - sf[3] = x[5]; - sf[4] = x[6]; - sf[5] = x[7]; - sf[6] = -x[0]*x[2] - x[1]*x[4] + x[2] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4]; - sf[7] = x[0]*x[2] + x[1]*x[4] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4]; - sf[8] = -x[2] - x[3] - x[8] + 1.0; - sf[9] = x[3]; - sf[10] = x[8]; - sf[11] = 1.0 - 0.5*x[1]; - sf[12] = 0.5*x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[8])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sqrt(sf[11])*sf[1]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[2]*sf[8])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[4]*sf[8] + d_em[3])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[3]*sf[8] + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sqrt(sf[5])*sf[8])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sqrt(sf[11])*sf[2]*sf[9])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[6])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[7])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(sf[10]*sqrt(sf[11])*sf[2])) + mu_Gex[9]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_cpx(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ilm -*/ -double obj_igd_ilm(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_ilm(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -0.5*x[0]*x[1] + 0.5*x[0] + 0.5*x[2]; - sf[1] = 0.5*x[0] - 0.5*x[3]; - sf[2] = 1.0 - x[0]; - sf[3] = 0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]; - sf[4] = -0.5*x[0]*x[1] + 0.5*x[0] - 0.5*x[2]; - sf[5] = 0.5*x[0] + 0.5*x[3]; - sf[6] = 1.0 - x[0]; - sf[7] = 0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(sqrt(sf[0])*sqrt(sf[5]))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*cpow(sf[0], 0.25)*cpow(sf[1], 0.25)*cpow(sf[4], 0.25)*cpow(sf[5], 0.25))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sqrt(sf[2])*sqrt(sf[6]) + d_em[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sqrt(sf[3])*sqrt(sf[5]))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(2.0*cpow(sf[1], 0.25)*cpow(sf[3], 0.25)*cpow(sf[5], 0.25)*cpow(sf[7], 0.25))) + mu_Gex[4]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_ilm(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of hb -*/ -double obj_igd_hb(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_hb(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = 1.0 - x[3]; - sf[1] = -x[3]*x[4] + x[3]; - sf[2] = x[3]*x[4]; - sf[3] = -x[0] + x[8] + 1.0; - sf[4] = x[0] - x[8]; - sf[5] = x[0]*x[1] + x[0]*x[6] + x[0]*x[7] - x[0] - x[1]*x[9] - x[1] - x[6]*x[9] - x[6] - x[7]*x[9] - x[7] + x[9] + 1.0; - sf[6] = -x[0]*x[1] - x[0]*x[6] - x[0]*x[7] + x[0] + x[1]*x[9] + x[6]*x[9] + x[7]*x[9] - x[9]; - sf[7] = x[1]; - sf[8] = x[6]; - sf[9] = x[7]; - sf[10] = x[5]; - sf[11] = x[0]*x[2] + x[0]*x[5] - x[0] + x[1]*x[9] - x[2] - x[5] + x[6]*x[9] + x[7]*x[9] - 1.5*x[8] - x[9] + 1.0; - sf[12] = -x[0]*x[2] - x[0]*x[5] + x[0] - x[1]*x[9] - x[6]*x[9] - x[7]*x[9] + 1.5*x[8] + x[9]; - sf[13] = x[2]; - sf[14] = -0.5*x[1] + 0.5*x[2] - 0.25*x[3] - 0.5*x[6] - 0.5*x[7] + 1.0; - sf[15] = 0.5*x[1] - 0.5*x[2] + 0.25*x[3] + 0.5*x[6] + 0.5*x[7]; - sf[16] = 1.0 - x[7]; - sf[17] = x[7]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*cpow(sf[10], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[7], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[1]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*cpow(sf[13], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[7], 2.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(sf[0]*cpow(sf[11], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[4], 3.0)*cpow(sf[6], 2.0))) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[6], 2.0))) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[4], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sf[0]*cpow(sf[13], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[8], 2.0) + d_em[8])) + mu_Gex[8]; - mu[9] = gb[9] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[2]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[9]; - mu[10] = gb[10] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[17], 2.0)*cpow(sf[3], 3.0)*cpow(sf[9], 2.0))) + mu_Gex[10]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_hb(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of bi -*/ -double obj_igd_bi(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_bi(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - x[1] - x[2] - x[3] - 2.0/3.0*x[4] + 1.0; - sf[1] = -x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[0] + 2.0/3.0*x[4]; - sf[2] = x[2]; - sf[3] = x[3]; - sf[4] = x[1]; - sf[5] = -x[0] + 1.0/3.0*x[4] + 1.0; - sf[6] = x[0] - 1.0/3.0*x[4]; - sf[7] = -0.5*x[1] - 0.5*x[2] + 0.5; - sf[8] = 0.5*x[1] + 0.5*x[2] + 0.5; - sf[9] = 1.0 - x[3]; - sf[10] = x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(4.0*sf[0]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(4.0*sf[1]*cpow(sf[6], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(4.0*sf[1]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[4]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(4.0*cpow(sf[10], 2.0)*sf[3]*cpow(sf[5], 2.0)*sf[7]*sf[8])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(sf[2]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0) + d_em[5])) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_bi(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of ep -*/ -double obj_igd_ep(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_igd_ep(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0] - x[1]; - sf[1] = -x[0] + x[1] + 1.0; - sf[2] = x[0] + x[1]; - sf[3] = -x[0] - x[1] + 1.0; - - mu[0] = gb[0] + R*T*creal(clog(sf[1]*sf[3])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sf[1]*sf[2] + d_em[1])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sf[2] + d_em[2])) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_ep(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - -
    [docs]/** - Objective function of cd -*/ -double obj_igd_cd(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - px_igd_cd(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = x[0]; - sf[1] = 1.0 - x[0]; - sf[2] = x[1]; - sf[3] = 1.0 - x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[3])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[0], 2.0)*sf[3])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[1], 2.0)*sf[2])) + mu_Gex[2]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_igd_cd(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    - - - - -
    [docs]/**************************************************************************************/ -/**************************************************************************************/ -/*********************METAPELITE DATABASE (White et al., 2014)*************************/ -/**************************************************************************************/ -/**************************************************************************************/ -/** - Update dpdx matrix of liq_mp -*/ -void dpdx_mp_liq(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 1.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = 0.0; dp_dx[0][3] = 0.0; dp_dx[0][4] = 0.0; dp_dx[0][5] = 0.0; dp_dx[0][6] = 0.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = x[2]; dp_dx[1][2] = x[1]; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0 - x[2]; dp_dx[2][2] = -x[1]; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; - dp_dx[4][0] = -1.0; dp_dx[4][1] = -1.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = -1.0; dp_dx[4][4] = -1.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = -1.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 1.0 - x[5]; dp_dx[5][5] = -x[4]; dp_dx[5][6] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = x[5]; dp_dx[6][5] = x[4]; dp_dx[6][6] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of pl4tr_mp -*/ -void dpdx_mp_pl4tr(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 1.0; -}
    - - -
    [docs]/** - Update dpdx matrix of bi_mp -*/ -void dpdx_mp_bi(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[3] + 3.0*x[1] + x[4] + x[2] - 1.0; dp_dx[0][1] = 3.0*x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = x[0] - 1.0; dp_dx[0][4] = x[0] - 1.0; dp_dx[0][5] = -2.0/3.0; - dp_dx[1][0] = 1.0; dp_dx[1][1] = 0.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = -1.0/3.0; - dp_dx[2][0] = -x[3] - 3.0*x[1] - x[4] - x[2]; dp_dx[2][1] = -3.0*x[0]; dp_dx[2][2] = -x[0]; dp_dx[2][3] = -x[0]; dp_dx[2][4] = -x[0]; dp_dx[2][5] = 1.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; dp_dx[4][5] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 1.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 1.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.0; -}
    - - - -
    [docs]/** - Update dpdx matrix of g_mp -*/ -void dpdx_mp_g(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[2] + x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = x[0] - 1.0; dp_dx[0][3] = -1.0; - dp_dx[1][0] = -x[2] - x[1] + 1.0; dp_dx[1][1] = -x[0]; dp_dx[1][2] = -x[0]; dp_dx[1][3] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 1.0; dp_dx[2][3] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; -}
    - - - -
    [docs]/** - Update dpdx matrix of ep_mp -*/ -void dpdx_mp_ep(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 2.0; - dp_dx[2][0] = 1.0; dp_dx[2][1] = -1.0; -}
    - -
    [docs]/** - Update dpdx matrix of ma_mp -*/ -void dpdx_mp_ma(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -1.0; - dp_dx[1][0] = x[1] - 1.0; dp_dx[1][1] = x[0] - 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; - dp_dx[2][0] = 1.0 - x[1]; dp_dx[2][1] = -x[0]; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; -}
    - -
    [docs]/** - Update dpdx matrix of mu_mp -*/ -void dpdx_mp_mu(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -1.0; - dp_dx[1][0] = x[1] - 1.0; dp_dx[1][1] = x[0] - 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; - dp_dx[2][0] = 1.0 - x[1]; dp_dx[2][1] = -x[0]; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; -}
    - -
    [docs]/** - Update dpdx matrix of opx_mp -*/ -void dpdx_mp_opx(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[4] + x[1] - 1.0; dp_dx[0][1] = 0.5*x[5] + x[0] - 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = 0.5*x[5] + x[0] - 1.0; dp_dx[0][5] = 0.5*x[4] + 0.5*x[1] - 0.5; - dp_dx[1][0] = -x[3] - x[1] - x[2] + 1.0; dp_dx[1][1] = 0.5*x[5] - x[0]; dp_dx[1][2] = -x[0]; dp_dx[1][3] = -x[0]; dp_dx[1][4] = 0.5*x[5]; dp_dx[1][5] = 0.5*x[4] + 0.5*x[1] - 0.5; - dp_dx[2][0] = -x[4] + x[3] + x[2]; dp_dx[2][1] = -x[5]; dp_dx[2][2] = x[0]; dp_dx[2][3] = x[0]; dp_dx[2][4] = -x[5] - x[0]; dp_dx[2][5] = -x[4] - x[1] + 1.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 1.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; dp_dx[5][5] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 1.0; dp_dx[6][5] = 0.0; -}
    - -
    [docs]/** - Update dpdx matrix of sa_mp -*/ -void dpdx_mp_sa(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = -1.0; dp_dx[0][1] = -1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -0.25; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; - dp_dx[2][0] = -x[2] - x[1] + 1.0; dp_dx[2][1] = -x[0]; dp_dx[2][2] = -x[0]; dp_dx[2][3] = -0.75; - dp_dx[3][0] = x[2] + x[1]; dp_dx[3][1] = x[0]; dp_dx[3][2] = x[0]; dp_dx[3][3] = 1.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 1.0; dp_dx[4][3] = 0.0; -}
    - -
    [docs]/** - Update dpdx matrix of cd_mp -*/ -void dpdx_mp_cd(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = -1.0; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = -x[0]; dp_dx[1][2] = 0.0; - dp_dx[2][0] = 0.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 1.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 1.0; dp_dx[3][2] = 0.0; -}
    - -
    [docs]/** - Update dpdx matrix of st_mp -*/ -void dpdx_mp_st(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; +void dpdx_mp_st(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; dp_dx[0][0] = x[1] - 1.0; dp_dx[0][1] = x[0] - 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -4.0/3.0; dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = -x[0]; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; @@ -7376,19 +3306,33 @@

    Source code for objective_functions.c

                 grad[i] = creal(dfx[i]);
             }
         }
    -
    -    return d->df;
    +
    +    return d->df;
    +}
    +
    [docs]/**************************************************************************************/ +/**************************************************************************************/ +/*********************IGNEOUS DATABASE (Holland et al., 2018)**************************/ +/**************************************************************************************/ +/**************************************************************************************/ +/** + Endmember to xeos for fper_S11 +*/ +void p2x_ig_fper(void *SS_ref_db, double eps){ + SS_ref *d = (SS_ref *) SS_ref_db; + + d->iguess[0] = d->p[1]; + + for (int i = 0; i < d->n_xeos; i++){ + if (d->iguess[i] < d->bounds[i][0]){ + d->iguess[i] = d->bounds[i][0]; + } + if (d->iguess[i] > d->bounds[i][1]){ + d->iguess[i] = d->bounds[i][1]; + } + } }
    -/**************************************************************************************/ -/**************************************************************************************/ -/*********************IGNEOUS DATABASE (Holland et al., 2018)**************************/ -/**************************************************************************************/ -/**************************************************************************************/ -
    [docs]/** - endmembers to xeos (biotite) -*/ -void p2x_ig_bi(void *SS_ref_db, double eps){ +
    void p2x_ig_bi(void *SS_ref_db, double eps){ SS_ref *d = (SS_ref *) SS_ref_db; d->iguess[0] = (d->p[0]-2.0*d->p[1]+d->p[5]+d->p[4]+d->p[3] -1.0)/(d->p[3]+d->p[4]+d->p[5]-3.0); @@ -7499,6 +3443,9 @@

    Source code for objective_functions.c

     	d->iguess[9]  = d->p[10];
     	
     	if (d->z_em[10] == 0.0){ d->iguess[9]  = eps;}
    +	if (d->z_em[7]  == 0.0){ d->iguess[6]  = eps;}
    +	if (d->z_em[6]  == 0.0){ d->iguess[5]  = eps;}
    +	if (d->z_em[8]  == 0.0){ d->iguess[7]  = eps;}
     		
     	for (int i = 0; i < d->n_xeos; i++){
     		if (d->iguess[i] < d->bounds[i][0]){
    @@ -7606,30 +3553,9 @@ 

    Source code for objective_functions.c

     	d->iguess[10] = d->p[11]/(1.0+3./4.*d->p[10]);
     		
     	if (d->z_em[11] == 0.0){ d->iguess[10] = eps;}
    -		
    -	for (int i = 0; i < d->n_xeos; i++){
    -		if (d->iguess[i] < d->bounds[i][0]){
    -			d->iguess[i] = d->bounds[i][0];
    -		}
    -		if (d->iguess[i] > d->bounds[i][1]){
    -			d->iguess[i] = d->bounds[i][1];
    -		}
    -	}
    -}
    - -
    [docs]/** - endmembers to xeos (muscovite) -*/ -void p2x_ig_mu(void *SS_ref_db, double eps){ - SS_ref *d = (SS_ref *) SS_ref_db; - - d->iguess[0] = d->p[2]/(1-(d->p[0]+d->p[4]+d->p[5]+d->p[3])); - d->iguess[1] = d->p[0]+d->p[4]+d->p[5]+d->p[3]; - d->iguess[2] = d->p[5]; - d->iguess[3] = d->p[3]; - d->iguess[4] = d->p[4]; - - if (d->z_em[5] == 0.0){ d->iguess[2] = eps;} + if (d->z_em[8] == 0.0){ d->iguess[7] = eps;} + if (d->z_em[7] == 0.0){ d->iguess[6] = eps;} + if (d->z_em[6] == 0.0){ d->iguess[5] = eps;} for (int i = 0; i < d->n_xeos; i++){ if (d->iguess[i] < d->bounds[i][0]){ @@ -7713,25 +3639,33 @@

    Source code for objective_functions.c

       endmembers to xeos (spinel)
     */
     void p2x_ig_spn(void *SS_ref_db, double eps){
    -    SS_ref *d  = (SS_ref *) SS_ref_db;
    -    
    -    d->iguess[2] = d->p[6];
    -    d->iguess[3] = d->p[7];
    -    d->iguess[1] = (-d->p[4] - d->p[5])/(d->iguess[2] + d->iguess[3] - 1.0);
    -    d->iguess[0] = (-d->iguess[2] - d->p[0] - d->p[1] + d->iguess[3] + 1.0)/(d->iguess[3] + 1.0);
    -    d->iguess[4] = -3.0*d->p[1]/2.0 - d->iguess[3]*d->iguess[0] + d->iguess[3] - d->iguess[0] + 1.0;
    -    d->iguess[6] = d->iguess[2]*d->iguess[1] + 3.0*d->p[5]/2.0 + d->iguess[3]*d->iguess[1] - d->iguess[1];
    -    d->iguess[5] = -d->iguess[6] + d->iguess[2]*d->iguess[1] - 3.0*d->p[3]/2.0 + d->iguess[3]*d->iguess[0] + d->iguess[3]*d->iguess[1] - 3.0*d->iguess[3]/2.0 + d->iguess[0] - d->iguess[1];
    -    
    -    for (int i = 0; i < d->n_xeos; i++){
    -        if (d->iguess[i] < d->bounds[i][0]){
    -            d->iguess[i] = d->bounds[i][0];
    -        }
    -        if (d->iguess[i] > d->bounds[i][1]){
    -            d->iguess[i] = d->bounds[i][1];
    -        }
    -    }
    +	SS_ref *d  = (SS_ref *) SS_ref_db;
    +
    +	d->iguess[0]  = (1.0 - d->p[6] - d->p[7] - d->p[0] - d->p[1])/(d->p[7] + 1.0);
    +	d->iguess[1]  = (d->p[4] + d->p[5])/(1.0 - d->p[6] - d->p[7]);
    +	d->iguess[2]  = d->p[6];
    +	d->iguess[3]  = d->p[7];
    +	d->iguess[4]  = 3./2.*d->p[0] - 1./2. + 3./2.*d->p[6] + d->p[7] + ((1.0 - d->p[6] - d->p[7] - d->p[0] - d->p[1])/(d->p[7] + 1.0))/2.*(1.0+d->p[7]);
    +	d->iguess[5]  = ((1.0 - d->p[6] - d->p[7] - d->p[0] - d->p[1])/(d->p[7] + 1.0))*(d->p[7] + 1.0) - 3./2.*d->p[3] - 3./2.*d->p[5];
    +	d->iguess[6]  = -3./2.*d->p[4] + ((d->p[4] + d->p[5])/(1.0 - d->p[6] - d->p[7]))*(1./2. -1./2.*d->p[6] - 1./2.*d->p[7]);
    +
    +	if (d->z_em[6]  == 0.0){ d->iguess[2]  = eps;}
    +	if (d->z_em[7]  == 0.0){ d->iguess[3]  = eps;}
    +	if (d->z_em[4]  == 0.0){ d->iguess[6]  = eps;}
    +	if (d->z_em[5]  == 0.0){ d->iguess[6]  = eps;}
    +	if (d->z_em[4]  == 0.0){ d->iguess[1]  = eps;}
    +	if (d->z_em[5]  == 0.0){ d->iguess[1]  = eps;}
    +	
    +	for (int i = 0; i < d->n_xeos; i++){
    +		if (d->iguess[i] < d->bounds[i][0]){
    +			d->iguess[i] = d->bounds[i][0];
    +		}
    +		if (d->iguess[i] > d->bounds[i][1]){
    +			d->iguess[i] = d->bounds[i][1];
    +		}
    +	}
     }
    +
    [docs]/** Endmember to xeos for bi_mp */ @@ -8072,6 +4006,17 @@

    Source code for objective_functions.c

         }
     }
    +
    [docs]/** + Update dpdx matrix of fper_S11 +*/ +void dpdx_ig_fper(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = -1.0; + dp_dx[1][0] = 1.0; +}
    +
    [docs]/** update dpdpx matrix (biotite) */ @@ -8139,20 +4084,19 @@

    Source code for objective_functions.c

         SS_ref *d  = (SS_ref *) SS_ref_db;
         double **dp_dx = d->dp_dx;
     
    -    dp_dx[0][0] = -1.00;      dp_dx[0][1] = -1.00;      dp_dx[0][2] = -1.00;      dp_dx[0][3] = -1.00;      dp_dx[0][4] = -1.00;      dp_dx[0][5] = -1.00;      dp_dx[0][6] = -1.00;      dp_dx[0][7] = -1.00;      dp_dx[0][8] = -1.00;      dp_dx[0][9] = -1.00;      
    -    dp_dx[1][0] = 0.0;      dp_dx[1][1] = 1.00;      dp_dx[1][2] = 0.0;      dp_dx[1][3] = 0.0;      dp_dx[1][4] = 0.0;      dp_dx[1][5] = 0.0;      dp_dx[1][6] = 0.0;      dp_dx[1][7] = 0.0;      dp_dx[1][8] = 0.0;      dp_dx[1][9] = 0.0;      
    -    dp_dx[2][0] = 1.00;      dp_dx[2][1] = 0.0;      dp_dx[2][2] = 0.0;      dp_dx[2][3] = 0.0;      dp_dx[2][4] = 0.0;      dp_dx[2][5] = 0.0;      dp_dx[2][6] = 0.0;      dp_dx[2][7] = 0.0;      dp_dx[2][8] = 0.0;      dp_dx[2][9] = 0.0;      
    -    dp_dx[3][0] = 0.0;      dp_dx[3][1] = 0.0;      dp_dx[3][2] = 1.00;      dp_dx[3][3] = 0.0;      dp_dx[3][4] = 0.0;      dp_dx[3][5] = 0.0;      dp_dx[3][6] = 0.0;      dp_dx[3][7] = 0.0;      dp_dx[3][8] = 0.0;      dp_dx[3][9] = 0.0;      
    -    dp_dx[4][0] = 0.0;      dp_dx[4][1] = 0.0;      dp_dx[4][2] = 0.0;      dp_dx[4][3] = 1.00;      dp_dx[4][4] = 0.0;      dp_dx[4][5] = 0.0;      dp_dx[4][6] = 0.0;      dp_dx[4][7] = 0.0;      dp_dx[4][8] = 0.0;      dp_dx[4][9] = 0.0;      
    -    dp_dx[5][0] = 0.0;      dp_dx[5][1] = 0.0;      dp_dx[5][2] = 0.0;      dp_dx[5][3] = 0.0;      dp_dx[5][4] = 1.00;      dp_dx[5][5] = 0.0;      dp_dx[5][6] = 0.0;      dp_dx[5][7] = 0.0;      dp_dx[5][8] = 0.0;      dp_dx[5][9] = 0.0;      
    -    dp_dx[6][0] = 0.0;      dp_dx[6][1] = 0.0;      dp_dx[6][2] = 0.0;      dp_dx[6][3] = 0.0;      dp_dx[6][4] = 0.0;      dp_dx[6][5] = 1.00;      dp_dx[6][6] = 0.0;      dp_dx[6][7] = 0.0;      dp_dx[6][8] = 0.0;      dp_dx[6][9] = 0.0;      
    -    dp_dx[7][0] = 0.0;      dp_dx[7][1] = 0.0;      dp_dx[7][2] = 0.0;      dp_dx[7][3] = 0.0;      dp_dx[7][4] = 0.0;      dp_dx[7][5] = 0.0;      dp_dx[7][6] = 1.00;      dp_dx[7][7] = 0.0;      dp_dx[7][8] = 0.0;      dp_dx[7][9] = 0.0;      
    -    dp_dx[8][0] = 0.0;      dp_dx[8][1] = 0.0;      dp_dx[8][2] = 0.0;      dp_dx[8][3] = 0.0;      dp_dx[8][4] = 0.0;      dp_dx[8][5] = 0.0;      dp_dx[8][6] = 0.0;      dp_dx[8][7] = 1.00;      dp_dx[8][8] = 0.0;      dp_dx[8][9] = 0.0;      
    -    dp_dx[9][0] = 0.0;      dp_dx[9][1] = 0.0;      dp_dx[9][2] = 0.0;      dp_dx[9][3] = 0.0;      dp_dx[9][4] = 0.0;      dp_dx[9][5] = 0.0;      dp_dx[9][6] = 0.0;      dp_dx[9][7] = 0.0;      dp_dx[9][8] = 1.00;      dp_dx[9][9] = 0.0;      
    -    dp_dx[10][0] = 0.0;      dp_dx[10][1] = 0.0;      dp_dx[10][2] = 0.0;      dp_dx[10][3] = 0.0;      dp_dx[10][4] = 0.0;      dp_dx[10][5] = 0.0;      dp_dx[10][6] = 0.0;      dp_dx[10][7] = 0.0;      dp_dx[10][8] = 0.0;      dp_dx[10][9] = 1.00;      
    +    dp_dx[0][0] = -1.0;      dp_dx[0][1] = -1.0;      dp_dx[0][2] = -1.0;      dp_dx[0][3] = -1.0;      dp_dx[0][4] = -1.0;      dp_dx[0][5] = -1.0;      dp_dx[0][6] = -1.0;      dp_dx[0][7] = -1.0;      dp_dx[0][8] = -1.0;      dp_dx[0][9] = -1.0;      
    +    dp_dx[1][0] = 0.0;      dp_dx[1][1] = 1.0;      dp_dx[1][2] = 0.0;      dp_dx[1][3] = 0.0;      dp_dx[1][4] = 0.0;      dp_dx[1][5] = 0.0;      dp_dx[1][6] = 0.0;      dp_dx[1][7] = 0.0;      dp_dx[1][8] = 0.0;      dp_dx[1][9] = 0.0;      
    +    dp_dx[2][0] = 1.0;      dp_dx[2][1] = 0.0;      dp_dx[2][2] = 0.0;      dp_dx[2][3] = 0.0;      dp_dx[2][4] = 0.0;      dp_dx[2][5] = 0.0;      dp_dx[2][6] = 0.0;      dp_dx[2][7] = 0.0;      dp_dx[2][8] = 0.0;      dp_dx[2][9] = 0.0;      
    +    dp_dx[3][0] = 0.0;      dp_dx[3][1] = 0.0;      dp_dx[3][2] = 1.0;      dp_dx[3][3] = 0.0;      dp_dx[3][4] = 0.0;      dp_dx[3][5] = 0.0;      dp_dx[3][6] = 0.0;      dp_dx[3][7] = 0.0;      dp_dx[3][8] = 0.0;      dp_dx[3][9] = 0.0;      
    +    dp_dx[4][0] = 0.0;      dp_dx[4][1] = 0.0;      dp_dx[4][2] = 0.0;      dp_dx[4][3] = 1.0;      dp_dx[4][4] = 0.0;      dp_dx[4][5] = 0.0;      dp_dx[4][6] = 0.0;      dp_dx[4][7] = 0.0;      dp_dx[4][8] = 0.0;      dp_dx[4][9] = 0.0;      
    +    dp_dx[5][0] = 0.0;      dp_dx[5][1] = 0.0;      dp_dx[5][2] = 0.0;      dp_dx[5][3] = 0.0;      dp_dx[5][4] = 1.0;      dp_dx[5][5] = 0.0;      dp_dx[5][6] = 0.0;      dp_dx[5][7] = 0.0;      dp_dx[5][8] = 0.0;      dp_dx[5][9] = 0.0;      
    +    dp_dx[6][0] = 0.0;      dp_dx[6][1] = 0.0;      dp_dx[6][2] = 0.0;      dp_dx[6][3] = 0.0;      dp_dx[6][4] = 0.0;      dp_dx[6][5] = 1.0;      dp_dx[6][6] = 0.0;      dp_dx[6][7] = 0.0;      dp_dx[6][8] = 0.0;      dp_dx[6][9] = 0.0;      
    +    dp_dx[7][0] = 0.0;      dp_dx[7][1] = 0.0;      dp_dx[7][2] = 0.0;      dp_dx[7][3] = 0.0;      dp_dx[7][4] = 0.0;      dp_dx[7][5] = 0.0;      dp_dx[7][6] = 1.0;      dp_dx[7][7] = 0.0;      dp_dx[7][8] = 0.0;      dp_dx[7][9] = 0.0;      
    +    dp_dx[8][0] = 0.0;      dp_dx[8][1] = 0.0;      dp_dx[8][2] = 0.0;      dp_dx[8][3] = 0.0;      dp_dx[8][4] = 0.0;      dp_dx[8][5] = 0.0;      dp_dx[8][6] = 0.0;      dp_dx[8][7] = 1.0;      dp_dx[8][8] = 0.0;      dp_dx[8][9] = 0.0;      
    +    dp_dx[9][0] = 0.0;      dp_dx[9][1] = 0.0;      dp_dx[9][2] = 0.0;      dp_dx[9][3] = 0.0;      dp_dx[9][4] = 0.0;      dp_dx[9][5] = 0.0;      dp_dx[9][6] = 0.0;      dp_dx[9][7] = 0.0;      dp_dx[9][8] = 1.0;      dp_dx[9][9] = 0.0;      
    +    dp_dx[10][0] = 0.0;      dp_dx[10][1] = 0.0;      dp_dx[10][2] = 0.0;      dp_dx[10][3] = 0.0;      dp_dx[10][4] = 0.0;      dp_dx[10][5] = 0.0;      dp_dx[10][6] = 0.0;      dp_dx[10][7] = 0.0;      dp_dx[10][8] = 0.0;      dp_dx[10][9] = 1.0;      
     }
    -
    [docs]/** update dpdpx matrix (garnet) */ @@ -8188,55 +4132,37 @@

    Source code for objective_functions.c

         dp_dx[10][0] = 0.0;      dp_dx[10][1] = 0.0;      dp_dx[10][2] = 0.0;      dp_dx[10][3] = 0.0;      dp_dx[10][4] = 0.0;      dp_dx[10][5] = 0.0;      dp_dx[10][6] = 0.0;      dp_dx[10][7] = 1.0;      dp_dx[10][8] = 0.0;      dp_dx[10][9] = 0.0;      
     }
    - -
    [docs]/** - Update dpdx matrix of ilm +
    [docs]/** + update dpdpx matrix (ilm) */ void dpdx_ig_ilm(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 0.0; dp_dx[0][2] = 1.0; dp_dx[0][3] = 0.0; - dp_dx[1][0] = 1.0 - x[1]; dp_dx[1][1] = - x[0]; dp_dx[1][2] = -1.0; dp_dx[1][3] = 0.0; - dp_dx[2][0] = -1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = -1.0; dp_dx[3][3] = 1.0; - dp_dx[4][0] = x[1]; dp_dx[4][1] = x[0]; dp_dx[4][2] = 1.0; dp_dx[4][3] = -1.0; + SS_ref *d = (SS_ref *) SS_ref_db; + double **dp_dx = d->dp_dx; + + dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; + dp_dx[1][0] = 1.0; dp_dx[1][1] = -1.0; + dp_dx[2][0] = -1.0; dp_dx[2][1] = 0.0; }
    - -
    [docs]/** - Update dpdx matrix of liqHw +
    [docs]/** + update dpdpx matrix (liquid) */ void dpdx_ig_liq(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; double **dp_dx = d->dp_dx; - dp_dx[0][0] = -0.75*x[9] - 1.0; dp_dx[0][1] = -0.75*x[9] - 1.0; dp_dx[0][2] = -0.75*x[9] - 1.0; dp_dx[0][3] = -0.75*x[9] - 1.0; dp_dx[0][4] = -0.75*x[9] - 1.0; dp_dx[0][5] = -0.75*x[9] - 1.0; dp_dx[0][6] = -0.75*x[9] - 1.0; dp_dx[0][7] = -0.75*x[9] - 1.0; dp_dx[0][8] = -0.75*x[9] - 1.0; dp_dx[0][9] = -0.75*x[6] - 0.75*x[3] - 0.75*x[2] - 0.75*x[10] - 0.75*x[5] - 0.75*x[4] - 0.75*x[8] - 0.75*x[1] - 0.75*x[7] - 0.75*x[0] + 1.0; dp_dx[0][10] = -0.75*x[9] - 1.0; - dp_dx[1][0] = 0.0; dp_dx[1][1] = 0.75*x[9] + 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 0.75*x[1] - 1.0; dp_dx[1][10] = 0.0; - dp_dx[2][0] = 0.75*x[9] + 1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 0.75*x[0] - 1.0; dp_dx[2][10] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.75*x[9] + 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 0.75*x[2]; dp_dx[3][10] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.75*x[9] + 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; dp_dx[4][9] = 0.75*x[3]; dp_dx[4][10] = 0.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.75*x[9] + 1.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 0.0; dp_dx[5][8] = 0.0; dp_dx[5][9] = 0.75*x[4]; dp_dx[5][10] = 0.0; - dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 0.75*x[9] + 1.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; dp_dx[6][9] = 0.75*x[5]; dp_dx[6][10] = 0.0; - dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 0.75*x[9] + 1.0; dp_dx[7][7] = 0.0; dp_dx[7][8] = 0.0; dp_dx[7][9] = 0.75*x[6]; dp_dx[7][10] = 0.0; - dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = 0.75*x[9] + 1.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 0.75*x[7]; dp_dx[8][10] = 0.0; - dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 0.75*x[9] + 1.0; dp_dx[9][9] = 0.75*x[8]; dp_dx[9][10] = 0.0; + dp_dx[0][0] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][1] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][2] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][3] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][4] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][5] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][6] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][7] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][8] = -3.0*x[9]/4.0 - 1.0; dp_dx[0][9] = -3.0*x[6]/4.0 - 3.0*x[3]/4.0 - 3.0*x[2]/4.0 - 3.0*x[10]/4.0 - 3.0*x[5]/4.0 - 3.0*x[4]/4.0 - 3.0*x[8]/4.0 - 3.0*x[1]/4.0 - 3.0*x[7]/4.0 - 3.0*x[0]/4.0 + 1.0; dp_dx[0][10] = -3.0*x[9]/4.0 - 1.0; + dp_dx[1][0] = 0.0; dp_dx[1][1] = 3.0*x[9]/4.0 + 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; dp_dx[1][5] = 0.0; dp_dx[1][6] = 0.0; dp_dx[1][7] = 0.0; dp_dx[1][8] = 0.0; dp_dx[1][9] = 3.0*x[1]/4.0 - 1.0; dp_dx[1][10] = 0.0; + dp_dx[2][0] = 3.0*x[9]/4.0 + 1.0; dp_dx[2][1] = 0.0; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; dp_dx[2][5] = 0.0; dp_dx[2][6] = 0.0; dp_dx[2][7] = 0.0; dp_dx[2][8] = 0.0; dp_dx[2][9] = 3.0*x[0]/4.0 - 1.0; dp_dx[2][10] = 0.0; + dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 3.0*x[9]/4.0 + 1.0; dp_dx[3][3] = 0.0; dp_dx[3][4] = 0.0; dp_dx[3][5] = 0.0; dp_dx[3][6] = 0.0; dp_dx[3][7] = 0.0; dp_dx[3][8] = 0.0; dp_dx[3][9] = 3.0*x[2]/4.0; dp_dx[3][10] = 0.0; + dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 3.0*x[9]/4.0 + 1.0; dp_dx[4][4] = 0.0; dp_dx[4][5] = 0.0; dp_dx[4][6] = 0.0; dp_dx[4][7] = 0.0; dp_dx[4][8] = 0.0; dp_dx[4][9] = 3.0*x[3]/4.0; dp_dx[4][10] = 0.0; + dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 0.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 3.0*x[9]/4.0 + 1.0; dp_dx[5][5] = 0.0; dp_dx[5][6] = 0.0; dp_dx[5][7] = 0.0; dp_dx[5][8] = 0.0; dp_dx[5][9] = 3.0*x[4]/4.0; dp_dx[5][10] = 0.0; + dp_dx[6][0] = 0.0; dp_dx[6][1] = 0.0; dp_dx[6][2] = 0.0; dp_dx[6][3] = 0.0; dp_dx[6][4] = 0.0; dp_dx[6][5] = 3.0*x[9]/4.0 + 1.0; dp_dx[6][6] = 0.0; dp_dx[6][7] = 0.0; dp_dx[6][8] = 0.0; dp_dx[6][9] = 3.0*x[5]/4.0; dp_dx[6][10] = 0.0; + dp_dx[7][0] = 0.0; dp_dx[7][1] = 0.0; dp_dx[7][2] = 0.0; dp_dx[7][3] = 0.0; dp_dx[7][4] = 0.0; dp_dx[7][5] = 0.0; dp_dx[7][6] = 3.0*x[9]/4.0 + 1.0; dp_dx[7][7] = 0.0; dp_dx[7][8] = 0.0; dp_dx[7][9] = 3.0*x[6]/4.0; dp_dx[7][10] = 0.0; + dp_dx[8][0] = 0.0; dp_dx[8][1] = 0.0; dp_dx[8][2] = 0.0; dp_dx[8][3] = 0.0; dp_dx[8][4] = 0.0; dp_dx[8][5] = 0.0; dp_dx[8][6] = 0.0; dp_dx[8][7] = 3.0*x[9]/4.0 + 1.0; dp_dx[8][8] = 0.0; dp_dx[8][9] = 3.0*x[7]/4.0; dp_dx[8][10] = 0.0; + dp_dx[9][0] = 0.0; dp_dx[9][1] = 0.0; dp_dx[9][2] = 0.0; dp_dx[9][3] = 0.0; dp_dx[9][4] = 0.0; dp_dx[9][5] = 0.0; dp_dx[9][6] = 0.0; dp_dx[9][7] = 0.0; dp_dx[9][8] = 3.0*x[9]/4.0 + 1.0; dp_dx[9][9] = 3.0*x[8]/4.0; dp_dx[9][10] = 0.0; dp_dx[10][0] = 0.0; dp_dx[10][1] = 0.0; dp_dx[10][2] = 0.0; dp_dx[10][3] = 0.0; dp_dx[10][4] = 0.0; dp_dx[10][5] = 0.0; dp_dx[10][6] = 0.0; dp_dx[10][7] = 0.0; dp_dx[10][8] = 0.0; dp_dx[10][9] = 1.0; dp_dx[10][10] = 0.0; - dp_dx[11][0] = 0.0; dp_dx[11][1] = 0.0; dp_dx[11][2] = 0.0; dp_dx[11][3] = 0.0; dp_dx[11][4] = 0.0; dp_dx[11][5] = 0.0; dp_dx[11][6] = 0.0; dp_dx[11][7] = 0.0; dp_dx[11][8] = 0.0; dp_dx[11][9] = 0.75*x[10]; dp_dx[11][10] = 0.75*x[9] + 1.0; -}
    -
    [docs]/** - update dpdpx matrix (muscovite) -*/ -void dpdx_ig_mu(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double **dp_dx = d->dp_dx; - - dp_dx[0][0] = 0.0; dp_dx[0][1] = 1.0; dp_dx[0][2] = -1.0; dp_dx[0][3] = -1.0; dp_dx[0][4] = -1.0; - dp_dx[1][0] = x[1] - 1.0; dp_dx[1][1] = x[0] - 1.0; dp_dx[1][2] = 0.0; dp_dx[1][3] = 0.0; dp_dx[1][4] = 0.0; - dp_dx[2][0] = 1.0 - x[1]; dp_dx[2][1] = -x[0]; dp_dx[2][2] = 0.0; dp_dx[2][3] = 0.0; dp_dx[2][4] = 0.0; - dp_dx[3][0] = 0.0; dp_dx[3][1] = 0.0; dp_dx[3][2] = 0.0; dp_dx[3][3] = 1.0; dp_dx[3][4] = 0.0; - dp_dx[4][0] = 0.0; dp_dx[4][1] = 0.0; dp_dx[4][2] = 0.0; dp_dx[4][3] = 0.0; dp_dx[4][4] = 1.0; - dp_dx[5][0] = 0.0; dp_dx[5][1] = 0.0; dp_dx[5][2] = 1.0; dp_dx[5][3] = 0.0; dp_dx[5][4] = 0.0; + dp_dx[11][0] = 0.0; dp_dx[11][1] = 0.0; dp_dx[11][2] = 0.0; dp_dx[11][3] = 0.0; dp_dx[11][4] = 0.0; dp_dx[11][5] = 0.0; dp_dx[11][6] = 0.0; dp_dx[11][7] = 0.0; dp_dx[11][8] = 0.0; dp_dx[11][9] = 3.0*x[10]/4.0; dp_dx[11][10] = 3.0*x[9]/4.0 + 1.0; }
    [docs]/** @@ -8287,17 +4213,18 @@

    Source code for objective_functions.c

       update dpdpx matrix (spinel)
     */
     void dpdx_ig_spn(void *SS_ref_db, const double *x){
    -    SS_ref *d  = (SS_ref *) SS_ref_db;
    -    double **dp_dx = d->dp_dx;
    +	SS_ref *d  = (SS_ref *) SS_ref_db;
    +	
    +	double **dp_dx = d->dp_dx;
     
    -    dp_dx[0][0] = -1./3.*x[3] - 1./3.;      dp_dx[0][1] = 0.0;      dp_dx[0][2] = -1.0;      dp_dx[0][3] = 1./3. - 1./3.*x[0];      dp_dx[0][4] = 2./3.;      dp_dx[0][5] = 0.0;      dp_dx[0][6] = 0.0;      
    -    dp_dx[1][0] = -2./3.*x[3] - 2./3.;      dp_dx[1][1] = 0.0;      dp_dx[1][2] = 0.0;      dp_dx[1][3] = 2./3. - 2./3.*x[0];      dp_dx[1][4] = -2./3.;      dp_dx[1][5] = 0.0;      dp_dx[1][6] = 0.0;      
    -    dp_dx[2][0] = 1./3.*x[3] + 1./3.;      dp_dx[2][1] = 1./3.*x[2] + 1./3.*x[3] - 1./3.;      dp_dx[2][2] = 1./3.*x[1];      dp_dx[2][3] = 1./3.*x[0] + 1./3.*x[1] - 1.0;      dp_dx[2][4] = 0.0;      dp_dx[2][5] = 2./3.;      dp_dx[2][6] = 2./3.;      
    -    dp_dx[3][0] = 2./3.*x[3] + 2./3.;      dp_dx[3][1] = 2./3.*x[2] + 2./3.*x[3] - 2./3.;      dp_dx[3][2] = 2./3.*x[1];      dp_dx[3][3] = 2./3.*x[0] + 2./3.*x[1] - 1.0;      dp_dx[3][4] = 0.0;      dp_dx[3][5] = -2./3.;      dp_dx[3][6] = -2./3.;      
    -    dp_dx[4][0] = 0.0;      dp_dx[4][1] = -1./3.*x[2] - 1./3.*x[3] + 1./3.;      dp_dx[4][2] = -1./3.*x[1];      dp_dx[4][3] = -1./3.*x[1];      dp_dx[4][4] = 0.0;      dp_dx[4][5] = 0.0;      dp_dx[4][6] = -2./3.;      
    -    dp_dx[5][0] = 0.0;      dp_dx[5][1] = -2./3.*x[2] - 2./3.*x[3] + 2./3.;      dp_dx[5][2] = -2./3.*x[1];      dp_dx[5][3] = -2./3.*x[1];      dp_dx[5][4] = 0.0;      dp_dx[5][5] = 0.0;      dp_dx[5][6] = 2./3.;      
    -    dp_dx[6][0] = 0.0;      dp_dx[6][1] = 0.0;      dp_dx[6][2] = 1.0;      dp_dx[6][3] = 0.0;      dp_dx[6][4] = 0.0;      dp_dx[6][5] = 0.0;      dp_dx[6][6] = 0.0;      
    -    dp_dx[7][0] = 0.0;      dp_dx[7][1] = 0.0;      dp_dx[7][2] = 0.0;      dp_dx[7][3] = 1.0;      dp_dx[7][4] = 0.0;      dp_dx[7][5] = 0.0;      dp_dx[7][6] = 0.0;      
    +	dp_dx[0][0] = -x[3]/3. - 1./3.;        dp_dx[0][1] = 0.0;         					dp_dx[0][2] = -1.0;        dp_dx[0][3] = -x[0]/3. - 2./3.;        dp_dx[0][4] = 2./3.;       dp_dx[0][5] = 0.0;         dp_dx[0][6] = 0.0;     
    +	dp_dx[1][0] = -2.*x[3]/3. - 2./3.;     dp_dx[1][1] = 0.0;         					dp_dx[1][2] = 0.0;         dp_dx[1][3] = -2.*x[0]/3. - 1./3.;     dp_dx[1][4] = -2./3.;      dp_dx[1][5] = 0.0;         dp_dx[1][6] = 0.0;     
    +	dp_dx[2][0] = x[3]/3. + 1./3.;         dp_dx[2][1] = x[2]/3. + x[3]/3. - 1./3.;         	dp_dx[2][2] = x[1]/3.;        dp_dx[2][3] = x[0]/3. + x[1]/3.;         	dp_dx[2][4] = 0.0;         dp_dx[2][5] = 2./3.;       dp_dx[2][6] = 2./3.;     
    +	dp_dx[3][0] = 2.*x[3]/3. + 2./3.;      dp_dx[3][1] = 2.*x[2]/3. + 2.*x[3]/3. - 2./3.;    dp_dx[3][2] = 2.*x[1]/3.;     dp_dx[3][3] = 2.*x[0]/3. + 2.*x[1]/3.;    dp_dx[3][4] = 0.0;         dp_dx[3][5] = -2./3.;      dp_dx[3][6] = -2./3.;     
    +	dp_dx[4][0] = 0.0;         			dp_dx[4][1] = -x[2]/3. - x[3]/3. + 1./3.;         dp_dx[4][2] = -x[1]/3.;       dp_dx[4][3] = -x[1]/3.;         		dp_dx[4][4] = 0.0;         dp_dx[4][5] = 0.0;         dp_dx[4][6] = -2./3.;     
    +	dp_dx[5][0] = 0.0;         			dp_dx[5][1] = -2.*x[2]/3. - 2.*x[3]/3. + 2./3.;   dp_dx[5][2] = -2.*x[1]/3.;    dp_dx[5][3] = -2.*x[1]/3.;         		dp_dx[5][4] = 0.0;         dp_dx[5][5] = 0.0;         dp_dx[5][6] = 2./3.;     
    +	dp_dx[6][0] = 0.0;         			dp_dx[6][1] = 0.0;         					dp_dx[6][2] = 1.0;         dp_dx[6][3] = 0.0;         			dp_dx[6][4] = 0.0;         dp_dx[6][5] = 0.0;         dp_dx[6][6] = 0.0;     
    +	dp_dx[7][0] = 0.0;         			dp_dx[7][1] = 0.0;        					dp_dx[7][2] = 0.0;         dp_dx[7][3] = 1.0;         			dp_dx[7][4] = 0.0;         dp_dx[7][5] = 0.0;         dp_dx[7][6] = 0.0;     
     }
    @@ -8314,6 +4241,15 @@

    Source code for objective_functions.c

             p[4]           = x[3];
             p[5]           = x[2];
     }
    +
    [docs]/** + Endmember fraction of fper_S11 +*/ +void px_ig_fper(void *SS_ref_db, const double *x){ + SS_ref *d = (SS_ref *) SS_ref_db; + double *p = d->p; + p[0] = 1.0 - 1.0*x[0]; + p[1] = x[0]; +}
    [docs]/** update px matrix (cordierite) @@ -8361,7 +4297,7 @@

    Source code for objective_functions.c

     void px_ig_fl(void *SS_ref_db, const double *x){
         SS_ref *d  = (SS_ref *) SS_ref_db;
         double *p = d->p;
    -        p[0]           = - x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0;
    +        p[0]           = - x[6] - x[3] - x[2] - x[9] - x[5] - x[4] - x[8] - x[1] - x[7] - x[0] + 1.0;
             p[1]           = x[1];
             p[2]           = x[0];
             p[3]           = x[2];
    @@ -8374,7 +4310,6 @@ 

    Source code for objective_functions.c

             p[10]           = x[9];
     }
    -
    [docs]/** update px matrix (garnet) */ @@ -8408,51 +4343,35 @@

    Source code for objective_functions.c

             p[10]           = x[7];
     }
    -
    [docs]/** - Endmember fraction of ilm +
    [docs]/** + update px matrix (ilm) */ void px_ig_ilm(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; double *p = d->p; - p[0] = x[2]; - p[1] = - x[0]*x[1] + x[0] - x[2]; + p[0] = x[1]; + p[1] = x[0] - x[1]; p[2] = 1.0 - x[0]; - p[3] = - x[2] + x[3]; - p[4] = x[0]*x[1] + x[2] - x[3]; }
    - -
    [docs]/** - Endmember fraction of liqHw +
    [docs]/** + update px matrix (liquid) */ void px_ig_liq(void *SS_ref_db, const double *x){ SS_ref *d = (SS_ref *) SS_ref_db; double *p = d->p; p[0] = - x[6] - x[3] - x[2] - x[10] - x[5] - x[4] - x[8] - x[1] - x[7] - x[0] + 0.25*x[9]*(-3.0*x[6] - 3.0*x[3] - 3.0*x[2] - 3.0*x[10] - 3.0*x[5] - 3.0*x[4] - 3.0*x[8] - 3.0*x[1] - 3.0*x[7] - 3.0*x[0] + 4.0) + 1.0; - p[1] = 0.75*x[1]*x[9] + x[1] - x[9]; - p[2] = 0.75*x[0]*x[9] + x[0] - x[9]; - p[3] = 0.75*x[2]*x[9] + x[2]; - p[4] = 0.75*x[3]*x[9] + x[3]; - p[5] = 0.75*x[4]*x[9] + x[4]; - p[6] = 0.75*x[5]*x[9] + x[5]; - p[7] = 0.75*x[6]*x[9] + x[6]; - p[8] = 0.75*x[7]*x[9] + x[7]; - p[9] = 0.75*x[8]*x[9] + x[8]; - p[10] = x[9]; - p[11] = 0.75*x[10]*x[9] + x[10]; -}
    -
    [docs]/** - update px matrix (muscovite) -*/ -void px_ig_mu(void *SS_ref_db, const double *x){ - SS_ref *d = (SS_ref *) SS_ref_db; - double *p = d->p; - p[0] = - x[4] - x[2] - x[3] + x[1]; - p[1] = x[0]*x[1] - x[0] - x[1] + 1.0; - p[2] = - x[0]*x[1] + x[0]; - p[3] = x[3]; - p[4] = x[4]; - p[5] = x[2]; + p[1] = 3.0*x[1]*x[9]/4.0 + x[1] - x[9]; + p[2] = 3.0*x[0]*x[9]/4.0 + x[0] - x[9]; + p[3] = 3.0*x[2]*x[9]/4.0 + x[2]; + p[4] = 3.0*x[3]*x[9]/4.0 + x[3]; + p[5] = 3.0*x[4]*x[9]/4.0 + x[4]; + p[6] = 3.0*x[5]*x[9]/4.0 + x[5]; + p[7] = 3.0*x[6]*x[9]/4.0 + x[6]; + p[8] = 3.0*x[7]*x[9]/4.0 + x[7]; + p[9] = 3.0*x[8]*x[9]/4.0 + x[8]; + p[10] = x[9]; + p[11] = 3.0*x[10]*x[9]/4.0 + x[10]; }
    [docs]/** @@ -8499,23 +4418,24 @@

    Source code for objective_functions.c

       update px matrix (spinel)
     */
     void px_ig_spn(void *SS_ref_db, const double *x){
    -    SS_ref *d  = (SS_ref *) SS_ref_db;
    -    double *p = d->p;
    -        p[0]           = -1./3.*x[0]*x[3] - 1./3.*x[0] -x[2] + 1./3.*x[3] + 2./3.*x[4] + 1./3.;
    -        p[1]           = -2./3.*x[0]*x[3] - 2./3.*x[0] + 2./3.*x[3] - 2./3.*x[4] + 2./3.;
    -        p[2]           = 1./3.*x[0]*x[3] + 1./3.*x[0] + 1./3.*x[1]*x[2] + 1./3.*x[1]*x[3] - 1./3.*x[1] -x[3] + 2./3.*x[5] + 2./3.*x[6];
    -        p[3]           = 2./3.*x[0]*x[3] + 2./3.*x[0] + 2./3.*x[1]*x[2] + 2./3.*x[1]*x[3] - 2./3.*x[1] -x[3] - 2./3.*x[5] - 2./3.*x[6];
    -        p[4]           = -1./3.*x[1]*x[2] - 1./3.*x[1]*x[3] + 1./3.*x[1] - 2./3.*x[6];
    -        p[5]           = -2./3.*x[1]*x[2] - 2./3.*x[1]*x[3] + 2./3.*x[1] + 2./3.*x[6];
    -        p[6]           = x[2];
    -        p[7]           = x[3];
    -}
    + SS_ref *d = (SS_ref *) SS_ref_db; + double *p = d->p; + p[0] = 2.*x[4]/3. - x[2] - x[3]*x[0]/3. - 2.*x[3]/3. - x[0]/3. + 1./3.; + p[1] = -2.*x[4]/3. - 2.*x[3]*x[0]/3. - x[3]/3. - 2.*x[0]/3. + 2./3.; + p[2] = 2.*x[5]/3. + 2.*x[6]/3. + x[2]*x[1]/3. + x[3]*x[0]/3. + x[3]*x[1]/3. + x[0]/3. - x[1]/3.; + p[3] = -2.*x[5]/3. - 2.*x[6]/3. + 2.*x[2]*x[1]/3. + 2.*x[3]*x[0]/3. + 2.*x[3]*x[1]/3. + 2.*x[0]/3. - 2.*x[1]/3.; + p[4] = -2.*x[6]/3. - x[2]*x[1]/3. - x[3]*x[1]/3. + x[1]/3.; + p[5] = 2.*x[6]/3. - 2.*x[2]*x[1]/3. - 2.*x[3]*x[1]/3. + 2.*x[1]/3.; + p[6] = x[2]; + p[7] = x[3]; +}
    -
    [docs]/** - objective function of biotite + +
    [docs]/** + Objective function of fper_S11 */ -double obj_ig_bi(unsigned n, const double *x, double *grad, void *SS_ref_db) { +double obj_ig_fper(unsigned n, const double *x, double *grad, void *SS_ref_db){ SS_ref *d = (SS_ref *) SS_ref_db; int n_em = d->n_em; @@ -8527,8 +4447,7 @@

    Source code for objective_functions.c

         double *mu_Gex    = d->mu_Gex;
         double *sf        = d->sf;
         double *mu        = d->mu;
    -    double *d_em      = d->d_em;
    -    px_ig_bi(SS_ref_db,x);
    +    px_ig_fper(SS_ref_db,x);
     
         for (int i = 0; i < n_em; i++){
             mu_Gex[i] = 0.0;
    @@ -8541,25 +4460,11 @@ 

    Source code for objective_functions.c

             }
         }
         
    -    sf[0]          = x[0]*x[1] + x[0]*x[2] + x[0]*x[3] - x[0] - x[1] - x[2] - x[3] - 2.0/3.0*x[4] + 1.0;
    -    sf[1]          = -x[0]*x[1] - x[0]*x[2] - x[0]*x[3] + x[0] + 2.0/3.0*x[4];
    -    sf[2]          = x[2];
    -    sf[3]          = x[3];
    -    sf[4]          = x[1];
    -    sf[5]          = -x[0] + 1.0/3.0*x[4] + 1.0;
    -    sf[6]          = x[0] - 1.0/3.0*x[4];
    -    sf[7]          = -0.5*x[1] - 0.5*x[2] + 0.5;
    -    sf[8]          = 0.5*x[1] + 0.5*x[2] + 0.5;
    -    sf[9]          = 1.0 - x[3];
    -    sf[10]          = x[3];
    -    
    +    sf[0]          = 1.0*x[0];
    +    sf[1]          = 1.0 - x[0];
         
    -    mu[0]          = gb[0] + R*T*creal(clog(4.0*sf[0]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[0];
    -    mu[1]          = gb[1] + R*T*creal(clog(4.0*sf[1]*cpow(sf[6], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[1];
    -    mu[2]          = gb[2] + R*T*creal(clog(4.0*sf[1]*cpow(sf[5], 2.0)*sf[7]*sf[8]*cpow(sf[9], 2.0))) + mu_Gex[2];
    -    mu[3]          = gb[3] + R*T*creal(clog(sf[4]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0))) + mu_Gex[3];
    -    mu[4]          = gb[4] + R*T*creal(clog(4.0*cpow(sf[10], 2.0)*sf[3]*cpow(sf[5], 2.0)*sf[7]*sf[8])) + mu_Gex[4];
    -    mu[5]          = gb[5] + R*T*creal(clog(sf[2]*cpow(sf[5], 2.0)*cpow(sf[8], 2.0)*cpow(sf[9], 2.0) + d_em[5])) + mu_Gex[5];
    +    mu[0]          = gb[0] + R*T*creal(clog(sf[1])) + mu_Gex[0];
    +    mu[1]          = gb[1] + R*T*creal(clog(sf[0])) + mu_Gex[1];
         
         d->sum_apep = 0.0;
         for (int i = 0; i < n_em; i++){
    @@ -8576,7 +4481,7 @@ 

    Source code for objective_functions.c

         if (grad){
             double *dfx    = d->dfx;
             double **dp_dx = d->dp_dx;
    -        dpdx_ig_bi(SS_ref_db,x);
    +        dpdx_ig_fper(SS_ref_db,x);
             for (int i = 0; i < (d->n_xeos); i++){
                 dfx[i] = 0.0;
                 for (int j = 0; j < n_em; j++){
    @@ -8587,8 +4492,86 @@ 

    Source code for objective_functions.c

         }
     
         return d->df;
    -};
    +}
    + + +
    [docs]/** + objective function of biotite +*/ +double obj_ig_bi(unsigned n, const double *x, double *grad, void *SS_ref_db) { + SS_ref *d = (SS_ref *) SS_ref_db; + + + int n_em = d->n_em; + double P = d->P; + double T = d->T; + double R = d->R; + + double *gb = d->gb_lvl; + double *mat_phi= d->mat_phi; + double *mu_Gex = d->mu_Gex; + double *sf = d->sf; + double *mu = d->mu; + double *d_em = d->d_em; + px_ig_bi(SS_ref_db,x); + + for (int i = 0; i < d->n_em; i++){ + mu_Gex[i] = 0.0; + int it = 0; + for (int j = 0; j < d->n_xeos; j++){ + for (int k = j+1; k < d->n_em; k++){ + mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); + it += 1; + } + } + } + + sf[0] = x[2]*x[0] - x[2] - 2.0/3.0*x[4] + x[3]*x[0] - x[3] + x[0]*x[1] - x[0] - x[1] + 1.0; + sf[1] = -x[2]*x[0] + 2.0/3.0*x[4] - x[3]*x[0] - x[0]*x[1] + x[0]; + sf[2] = x[2]; + sf[3] = x[3]; + sf[4] = x[1]; + sf[5] = 1.0/3.0*x[4] - x[0] + 1.0; + sf[6] = -1.0/3.0*x[4] + x[0]; + sf[7] = -0.5*x[2] - 0.5*x[1] + 0.5; + sf[8] = 0.5*x[2] + 0.5*x[1] + 0.5; + sf[9] = 1.0 - x[3]; + sf[10] = x[3]; + + mu[0] = R*T*creal(clog( 4.0*sf[0]*pow(sf[5], 2.0)*sf[7]*sf[8]*pow(sf[9], 2.0))) + gb[0] + mu_Gex[0]; + mu[1] = R*T*creal(clog( 4.0*sf[1]*pow(sf[6], 2.0)*sf[7]*sf[8]*pow(sf[9], 2.0))) + gb[1] + mu_Gex[1]; + mu[2] = R*T*creal(clog( 4.0*sf[1]*pow(sf[5], 2.0)*sf[7]*sf[8]*pow(sf[9], 2.0))) + gb[2] + mu_Gex[2]; + mu[3] = R*T*creal(clog( sf[4]*pow(sf[5], 2.0)*pow(sf[8], 2.0)*pow(sf[9], 2.0))) + gb[3] + mu_Gex[3]; + mu[4] = R*T*creal(clog( 4.0*sf[3]*pow(sf[5], 2.0)*sf[7]*sf[8])* pow(sf[10], 2.0)) + gb[4] + mu_Gex[4]; + mu[5] = R*T*creal(clog( sf[2]*pow(sf[5], 2.0)*pow(sf[8], 2.0)*pow(sf[9], 2.0) + d_em[5])) + gb[5] + mu_Gex[5]; + + d->sum_apep = 0.0; + for (int i = 0; i < n_em; i++){ + d->sum_apep += d->ape[i]*d->p[i]; + } + d->factor = d->fbc/d->sum_apep; + + d->df_raw = 0.0; + for (int i = 0; i < d->n_em; i++){ + d->df_raw += mu[i]*d->p[i]; + } + d->df = d->df_raw * d->factor; + + if (grad){ + double *dfx = d->dfx; + double **dp_dx = d->dp_dx; + dpdx_ig_bi(SS_ref_db,x); + for (int i = 0; i < (d->n_xeos); i++){ + dfx[i] = 0.0; + for (int j = 0; j < n_em; j++){ + dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; + } + grad[i] = creal(dfx[i]); + } + } + return d->df; +};
    [docs]/** objective function of cordierite */ @@ -8661,93 +4644,97 @@

    Source code for objective_functions.c

       objective function of clinopyroxene
     */
     double obj_ig_cpx(unsigned n, const double *x, double *grad, void *SS_ref_db) {
    -    SS_ref *d         = (SS_ref *) SS_ref_db;
     
    -    int n_em          = d->n_em;
    -    double P          = d->P;
    -    double T          = d->T;
    -    double R          = d->R;
    +	SS_ref *d  = (SS_ref *) SS_ref_db;
     
    -    double *gb        = d->gb_lvl;
    -    double *mat_phi   = d->mat_phi;
    -    double *mu_Gex    = d->mu_Gex;
    -    double *sf        = d->sf;
    -    double *mu        = d->mu;
    -    double *d_em      = d->d_em;
    -    px_ig_cpx(SS_ref_db,x);
     
    -    d->sum_v = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->sum_v += d->p[i]*d->v[i];
    -    }
    -    for (int i = 0; i < n_em; i++){
    -        d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v;
    -    }
    -    
    -    for (int i = 0; i < d->n_em; i++){
    -        mu_Gex[i] = 0.0;
    -        int it = 0;
    -        for (int j = 0; j < d->n_xeos; j++){
    -            for (int k = j+1; k < d->n_em; k++){
    -                mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k]));
    -                it += 1;
    -            }
    -        }
    -    }
    -    
    -    sf[0]          = x[0]*x[1] + x[0]*x[3] - x[0]*x[7] + x[0]*x[8] - x[0] + x[1]*x[4] - x[1] + x[3]*x[4] - x[3] - x[4]*x[7] + x[4]*x[8] - x[4] + x[7] - x[8] + 1.0;
    -    sf[1]          = -x[0]*x[1] - x[0]*x[3] + x[0]*x[7] - x[0]*x[8] + x[0] - x[1]*x[4] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4];
    -    sf[2]          = x[1] + x[3] - x[5] - x[6] - 2.0*x[7] + x[8];
    -    sf[3]          = x[5];
    -    sf[4]          = x[6];
    -    sf[5]          = x[7];
    -    sf[6]          = -x[0]*x[2] - x[1]*x[4] + x[2] - x[3]*x[4] + x[4]*x[7] - x[4]*x[8] + x[4];
    -    sf[7]          = x[0]*x[2] + x[1]*x[4] + x[3]*x[4] - x[4]*x[7] + x[4]*x[8] - x[4];
    -    sf[8]          = -x[2] - x[3] - x[8] + 1.0;
    -    sf[9]          = x[3];
    -    sf[10]          = x[8];
    -    sf[11]          = 1.0 - 0.5*x[1];
    -    sf[12]          = 0.5*x[1];
    -    
    -    
    -    mu[0]          = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[8])) + mu_Gex[0];
    -    mu[1]          = gb[1] + R*T*creal(clog(sqrt(sf[11])*sf[1]*sf[7])) + mu_Gex[1];
    -    mu[2]          = gb[2] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[2]*sf[8])) + mu_Gex[2];
    -    mu[3]          = gb[3] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[4]*sf[8] + d_em[3])) + mu_Gex[3];
    -    mu[4]          = gb[4] + R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[3]*sf[8] + d_em[4])) + mu_Gex[4];
    -    mu[5]          = gb[5] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sqrt(sf[5])*sf[8])) + mu_Gex[5];
    -    mu[6]          = gb[6] + R*T*creal(clog(sqrt(sf[11])*sf[2]*sf[9])) + mu_Gex[6];
    -    mu[7]          = gb[7] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[6])) + mu_Gex[7];
    -    mu[8]          = gb[8] + R*T*creal(clog(sf[0]*sqrt(sf[11])*sf[7])) + mu_Gex[8];
    -    mu[9]          = gb[9] + R*T*creal(clog(sf[10]*sqrt(sf[11])*sf[2])) + mu_Gex[9];
    -    
    -    d->sum_apep = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->sum_apep += d->ape[i]*d->p[i];
    -    }
    -    d->factor = d->fbc/d->sum_apep;
    +	int n_em   = d->n_em;
    +	double P   = d->P;
    +	double T   = d->T;
    +	double R   = d->R;
    +
    +	double *gb     = d->gb_lvl;
    +	double *p      = d->p;
    +	double *mat_phi= d->mat_phi;
    +	double *mu_Gex = d->mu_Gex;
    +	double *sf     = d->sf;
    +	double *mu     = d->mu;
    +    double *d_em   = d->d_em;
    +
    +	px_ig_cpx(SS_ref_db,x);
    +
    +	d->sum_v = 0.0;
    +	for (int i = 0; i < d->n_em; i++){
    +		d->sum_v += d->p[i]*d->v[i];
    +	}
    +	for (int i = 0; i < d->n_em; i++){
    +		d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v;
    +	}
    +
    +	for (int i = 0; i < d->n_em; i++){
    +		mu_Gex[i] = 0.0;
    +		int it = 0;
    +		for (int j = 0; j < d->n_xeos; j++){
    +			for (int k = j+1; k < d->n_em; k++){
    +				mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k]));
    +				it += 1;
    +			}
    +		}
    +	}
    +	
    +    sf[0]           = x[8]*x[4] + x[8]*x[0] - x[8] + x[3]*x[4] + x[3]*x[0] - x[3] - x[4]*x[7] + x[4]*x[1] - x[4] - x[7]*x[0] + x[7] + x[0]*x[1] - x[0] - x[1] + 1.0;
    +    sf[1]           = -x[8]*x[4] - x[8]*x[0] - x[3]*x[4] - x[3]*x[0] + x[4]*x[7] - x[4]*x[1] + x[4] + x[7]*x[0] - x[0]*x[1] + x[0];
    +    sf[2]           = -x[6] - x[5] + x[8] + x[3] - 2.0*x[7] + x[1];
    +    sf[3]           = x[5];
    +    sf[4]           = x[6];
    +    sf[5]           = x[7];
    +    sf[6]           = -x[8]*x[4] - x[3]*x[4] - x[2]*x[0] + x[2] + x[4]*x[7] - x[4]*x[1] + x[4];
    +    sf[7]           = x[8]*x[4] + x[3]*x[4] + x[2]*x[0] - x[4]*x[7] + x[4]*x[1] - x[4];
    +    sf[8]           = -x[8] - x[3] - x[2] + 1.0;
    +    sf[9]           = x[3];
    +    sf[10]           = x[8];
    +    sf[11]           = 1.0 - 0.5*x[1];
    +    sf[12]           = 0.5*x[1];
    +
    +	mu[0]          = R*T*creal(clog(sf[0]*csqrt(sf[11])*sf[8])) + gb[0] + mu_Gex[0];
    +	mu[1]          = R*T*creal(clog(csqrt(sf[11])*sf[1]*sf[7])) + gb[1] + mu_Gex[1];
    +	mu[2]          = R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[2]*sf[8])) + gb[2] + mu_Gex[2];
    +	mu[3]          = R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[4]*sf[8] + d_em[3])) + gb[3] + mu_Gex[3];
    +	mu[4]          = R*T*creal(clog(1.4142*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*sf[3]*sf[8] + d_em[4])) + gb[4] + mu_Gex[4];
    +	mu[5]          = R*T*creal(clog(2.8284*csqrt(sf[0])*cpow(sf[11], 0.25)*cpow(sf[12], 0.25)*csqrt(sf[5])*sf[8])) + gb[5] + mu_Gex[5];
    +	mu[6]          = R*T*creal(clog(csqrt(sf[11])*sf[2]*sf[9])) + gb[6] + mu_Gex[6];
    +	mu[7]          = R*T*creal(clog(sf[0]*csqrt(sf[11])*sf[6])) + gb[7] + mu_Gex[7];
    +	mu[8]          = R*T*creal(clog(sf[0]*csqrt(sf[11])*sf[7])) + gb[8] + mu_Gex[8];
    +	mu[9]          = R*T*creal(clog(sf[10]*csqrt(sf[11])*sf[2])) + gb[9] + mu_Gex[9];
     
    -    d->df_raw = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->df_raw += mu[i]*d->p[i];
    -    }
    -    d->df = d->df_raw * d->factor;
    +	d->sum_apep = 0.0;
    +	for (int i = 0; i < n_em; i++){
    +	   d->sum_apep += d->ape[i]*d->p[i];
    +	}
    +	d->factor = d->fbc/d->sum_apep;
     
    -    if (grad){
    -        double *dfx    = d->dfx;
    -        double **dp_dx = d->dp_dx;
    -        dpdx_ig_cpx(SS_ref_db,x);
    -        for (int i = 0; i < (d->n_xeos); i++){
    -            dfx[i] = 0.0;
    -            for (int j = 0; j < n_em; j++){
    -                dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    -            }
    -            grad[i] = creal(dfx[i]);
    -        }
    -    }
    +	d->df_raw = 0.0;
    +	for (int i = 0; i < d->n_em; i++){
    +		d->df_raw += mu[i]*d->p[i];
    +	}
    +	d->df = d->df_raw * d->factor;
    +	
    +	if (grad){
    +	double *dfx    = d->dfx;
    +	double **dp_dx = d->dp_dx;
    +		dpdx_ig_cpx(SS_ref_db,x);
    +		for (int i = 0; i < (d->n_xeos); i++){
    +		   dfx[i] = 0.0;
    +		   for (int j = 0; j < n_em; j++){
    +			   dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    +		   }
    +		   grad[i] = creal(dfx[i]);
    +		}
    +	}
    +
    +	return d->df;
    +};
    - return d->df; -}
    [docs]/** objective function of epidote @@ -8819,172 +4806,179 @@

    Source code for objective_functions.c

       objective function of fluid
     */
     double obj_ig_fl(unsigned  n, const double *x, double *grad, void *SS_ref_db) {
    -    SS_ref *d         = (SS_ref *) SS_ref_db;
     
    -    int n_em          = d->n_em;
    -    double P          = d->P;
    -    double T          = d->T;
    -    double R          = d->R;
    +	SS_ref *d  = (SS_ref *) SS_ref_db;
     
    -    double *gb        = d->gb_lvl;
    -    double *mu_Gex    = d->mu_Gex;
    -    double *sf        = d->sf;
    -    double *mu        = d->mu;
    -    double *d_em      = d->d_em;
    -    px_ig_fl(SS_ref_db,x);
     
    -    for (int i = 0; i < n_em; i++){
    -        mu_Gex[i] = 0.0;
    -        int it    = 0;
    -        for (int j = 0; j < d->n_xeos; j++){
    -            for (int k = j+1; k < n_em; k++){
    -                mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]);
    -                it += 1;
    -            }
    -        }
    -    }
    -    
    -    sf[0]          = -x[0] - x[1] - x[2] - x[3] - x[4] - x[5] - x[6] - x[7] - x[8] - x[9] + 1.0;
    -    sf[1]          = x[1];
    -    sf[2]          = x[0];
    -    sf[3]          = x[2];
    -    sf[4]          = x[3];
    -    sf[5]          = x[4];
    -    sf[6]          = x[5];
    -    sf[7]          = x[6];
    -    sf[8]          = x[7];
    -    sf[9]          = x[8];
    -    sf[10]          = x[9];
    -    sf[11]          = 1.0 - x[9];
    -    
    -    mu[0]          = gb[0] + R*T*creal(clog(sf[0]*sf[11])) + mu_Gex[0];
    -    mu[1]          = gb[1] + R*T*creal(clog(sf[11]*sf[1])) + mu_Gex[1];
    -    mu[2]          = gb[2] + R*T*creal(clog(sf[11]*sf[2])) + mu_Gex[2];
    -    mu[3]          = gb[3] + R*T*creal(clog(sf[11]*sf[3])) + mu_Gex[3];
    -    mu[4]          = gb[4] + R*T*creal(clog(sf[11]*sf[4])) + mu_Gex[4];
    -    mu[5]          = gb[5] + R*T*creal(clog(sf[11]*sf[5])) + mu_Gex[5];
    -    mu[6]          = gb[6] + R*T*creal(clog(sf[11]*sf[6]+d_em[6])) + mu_Gex[6];
    -    mu[7]          = gb[7] + R*T*creal(clog(sf[11]*sf[7]+d_em[7])) + mu_Gex[7];
    -    mu[8]          = gb[8] + R*T*creal(clog(sf[11]*sf[8])) + mu_Gex[8];
    -    mu[9]          = gb[9] + R*T*creal(clog(sf[11]*sf[9])) + mu_Gex[9];
    -    mu[10]          = gb[10] + R*T*creal(clog(cpow(sf[10], 2.0))) + mu_Gex[10];
    -    
    -    d->sum_apep = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->sum_apep += d->ape[i]*d->p[i];
    -    }
    -    d->factor = d->fbc/d->sum_apep;
    +	int n_em   = d->n_em;
    +	double P   = d->P;
    +	double T   = d->T;
    +	double R   = d->R;
     
    -    d->df_raw = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->df_raw += mu[i]*d->p[i];
    -    }
    -    d->df = d->df_raw * d->factor;
    +	double *gb     = d->gb_lvl;
    +	double *mat_phi= d->mat_phi;
    +	double *mu_Gex = d->mu_Gex;
    +	double *sf     = d->sf;
    +	double *mu     = d->mu;
    +    double *d_em   = d->d_em;
     
    -    if (grad){
    -        double *dfx    = d->dfx;
    -        double **dp_dx = d->dp_dx;
    -        dpdx_ig_fl(SS_ref_db,x);
    -        for (int i = 0; i < (d->n_xeos); i++){
    -            dfx[i] = 0.0;
    -            for (int j = 0; j < n_em; j++){
    -                dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    -            }
    -            grad[i] = creal(dfx[i]);
    -        }
    -    }
    +	px_ig_fl(SS_ref_db,x);
    +
    +	for (int i = 0; i < d->n_em; i++){
    +		mu_Gex[i] = 0.0;
    +		int it = 0;
    +		for (int j = 0; j < d->n_xeos; j++){
    +			for (int k = j+1; k < d->n_em; k++){
    +				mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]);
    +				it += 1;
    +			}
    +		}
    +	}
    +	
    +    sf[0]           = -x[6] - x[3] - x[2] - x[9] - x[5] - x[4] - x[8] - x[1] - x[7] - x[0] + 1.0;
    +    sf[1]           = x[1];
    +    sf[2]           = x[0];
    +    sf[3]           = x[2];
    +    sf[4]           = x[3];
    +    sf[5]           = x[4];
    +    sf[6]           = x[5];
    +    sf[7]           = x[6];
    +    sf[8]           = x[7];
    +    sf[9]           = x[8];
    +    sf[10]           = x[9];
    +    sf[11]           = 1.0 - x[9];
    +
    +	mu[0]          = R*T*creal(clog(sf[0]*sf[11]))  + gb[0]  + mu_Gex[0];
    +	mu[1]          = R*T*creal(clog(sf[11]*sf[1]))  + gb[1]  + mu_Gex[1];
    +	mu[2]          = R*T*creal(clog(sf[11]*sf[2]))  + gb[2]  + mu_Gex[2];
    +	mu[3]          = R*T*creal(clog(sf[11]*sf[3]))  + gb[3]  + mu_Gex[3];
    +	mu[4]          = R*T*creal(clog(sf[11]*sf[4]))  + gb[4]  + mu_Gex[4];
    +	mu[5]          = R*T*creal(clog(sf[11]*sf[5]))  + gb[5]  + mu_Gex[5];
    +	mu[6]          = R*T*creal(clog(sf[11]*sf[6] + d_em[6]))  + gb[6]  + mu_Gex[6];
    +	mu[7]          = R*T*creal(clog(sf[11]*sf[7] + d_em[7]))  + gb[7]  + mu_Gex[7];
    +	mu[8]          = R*T*creal(clog(sf[11]*sf[8]))  + gb[8]  + mu_Gex[8];
    +	mu[9]          = R*T*creal(clog(sf[11]*sf[9]))  + gb[9]  + mu_Gex[9];
    +	mu[10]         = R*T*creal(clog( pow(sf[10], 2.0))) + gb[10] + mu_Gex[10];
    +
    +	d->sum_apep = 0.0;
    +	for (int i = 0; i < n_em; i++){
    +	   d->sum_apep += d->ape[i]*d->p[i];
    +	}
    +	d->factor = d->fbc/d->sum_apep;
    +
    +	d->df_raw = 0.0;
    +	for (int i = 0; i < d->n_em; i++){
    +		d->df_raw += mu[i]*d->p[i];
    +	}
    +	d->df = d->df_raw * d->factor;
    +	
    +	if (grad){
    +	double *dfx    = d->dfx;
    +	double **dp_dx = d->dp_dx;
    +		dpdx_ig_fl(SS_ref_db,x);
    +		for (int i = 0; i < (d->n_xeos); i++){
    +		   dfx[i] = 0.0;
    +		   for (int j = 0; j < n_em; j++){
    +			   dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    +		   }
    +		   grad[i] = creal(dfx[i]);
    +		}
    +	}
    +
    +	return d->df;
    +};
    - return d->df; -}
    [docs]/** objective function of garnet */ double obj_ig_g(unsigned n, const double *x, double *grad, void *SS_ref_db) { - SS_ref *d = (SS_ref *) SS_ref_db; - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; + SS_ref *d = (SS_ref *) SS_ref_db; - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_ig_g(SS_ref_db,x); - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0] - x[1] + 1.0; - sf[1] = -x[0]*x[1] + x[0]; - sf[2] = x[1]; - sf[3] = -x[2] - x[3] - 2.0*x[4] + 1.0; - sf[4] = x[3]; - sf[5] = x[2]; - sf[6] = x[4]; - sf[7] = x[4]; - - - mu[0] = gb[0] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(cpow(sf[1], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[3], 2.0))) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(cpow(sf[2], 3.0)*cpow(sf[5], 2.0) + d_em[3])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(cpow(sf[0], 3.0)*cpow(sf[4], 2.0) + d_em[4])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(8.0*cpow(sf[0], 3.0)*sf[3]*sqrt(sf[6])*sqrt(sf[7]))) + mu_Gex[5]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; + int n_em = d->n_em; + double P = d->P; + double T = d->T; + double R = d->R; - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; + double *gb = d->gb_lvl; + double *mat_phi= d->mat_phi; + double *mu_Gex = d->mu_Gex; + double *sf = d->sf; + double *mu = d->mu; + double *d_em = d->d_em; - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_ig_g(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } + px_ig_g(SS_ref_db,x); + + d->sum_v = 0.0; + for (int i = 0; i < d->n_em; i++){ + d->sum_v += d->p[i]*d->v[i]; + } + for (int i = 0; i < d->n_em; i++){ + d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; + } + + for (int i = 0; i < d->n_em; i++){ + mu_Gex[i] = 0.0; + int it = 0; + for (int j = 0; j < d->n_xeos; j++){ + for (int k = j+1; k < d->n_em; k++){ + mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); + it += 1; + } + } + } + + sf[0] = x[1]*x[0] - x[1] - x[0] + 1.0; + sf[1] = -x[1]*x[0] + x[0]; + sf[2] = x[1]; + sf[3] = -x[3] - x[2] - 2.0*x[4] + 1.0; + sf[4] = x[3]; + sf[5] = x[2]; + sf[6] = x[4]; + + mu[0] = R*T*creal(clog( pow(sf[0], 3.0)* pow(sf[3], 2.0))) + gb[0] + mu_Gex[0]; + mu[1] = R*T*creal(clog( pow(sf[1], 3.0)* pow(sf[3], 2.0))) + gb[1] + mu_Gex[1]; + mu[2] = R*T*creal(clog( pow(sf[2], 3.0)* pow(sf[3], 2.0))) + gb[2] + mu_Gex[2]; + mu[3] = R*T*creal(clog( pow(sf[2], 3.0)* pow(sf[5], 2.0) + d_em[3])) + gb[3] + mu_Gex[3]; + mu[4] = R*T*creal(clog( pow(sf[0], 3.0)* pow(sf[4], 2.0) + d_em[4])) + gb[4] + mu_Gex[4]; + mu[5] = R*T*creal(clog(8.0* pow(sf[0], 3.0)*sf[3]*sf[6])) + gb[5] + mu_Gex[5]; + + d->sum_apep = 0.0; + for (int i = 0; i < n_em; i++){ + d->sum_apep += d->ape[i]*d->p[i]; + } + d->factor = d->fbc/d->sum_apep; + + d->df_raw = 0.0; + for (int i = 0; i < d->n_em; i++){ + d->df_raw += mu[i]*d->p[i]; + } + d->df = d->df_raw * d->factor; + + if (grad){ + double *dfx = d->dfx; + double **dp_dx = d->dp_dx; + dpdx_ig_g(SS_ref_db,x); + for (int i = 0; i < (d->n_xeos); i++){ + dfx[i] = 0.0; + for (int j = 0; j < n_em; j++){ + dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; + } + grad[i] = creal(dfx[i]); + } + } + + return d->df; +};
    - return d->df; -}
    [docs]/** objective function of hornblende */ double obj_ig_hb(unsigned n, const double *x, double *grad, void *SS_ref_db) { - SS_ref *d = (SS_ref *) SS_ref_db; + SS_ref *d = (SS_ref *) SS_ref_db; int n_em = d->n_em; double P = d->P; @@ -9035,9 +5029,7 @@

    Source code for objective_functions.c

         sf[14]          = -0.5*x[1] + 0.5*x[2] - 0.25*x[3] - 0.5*x[6] - 0.5*x[7] + 1.0;
         sf[15]          = 0.5*x[1] - 0.5*x[2] + 0.25*x[3] + 0.5*x[6] + 0.5*x[7];
         sf[16]          = 1.0 - x[7];
    -    sf[17]          = x[7];
    -    
    -    
    +
         mu[0]          = gb[0] + R*T*creal(clog(sf[0]*cpow(sf[10], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[0];
         mu[1]          = gb[1] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[7], 2.0))) + mu_Gex[1];
         mu[2]          = gb[2] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[1]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[2];
    @@ -9048,7 +5040,7 @@ 

    Source code for objective_functions.c

         mu[7]          = gb[7] + R*T*creal(clog(sf[0]*cpow(sf[12], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[4], 3.0)*cpow(sf[5], 2.0))) + mu_Gex[7];
         mu[8]          = gb[8] + R*T*creal(clog(sf[0]*cpow(sf[13], 2.0)*sf[14]*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[8], 2.0) + d_em[8])) + mu_Gex[8];
         mu[9]          = gb[9] + R*T*creal(clog(8.0*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*sf[2]*cpow(sf[3], 3.0)*sf[5]*sf[7])) + mu_Gex[9];
    -    mu[10]          = gb[10] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[17], 2.0)*cpow(sf[3], 3.0)*cpow(sf[9], 2.0))) + mu_Gex[10];
    +    mu[10]         = gb[10] + R*T*creal(clog(2.0*sf[0]*cpow(sf[10], 2.0)*sqrt(sf[14])*sqrt(sf[15])*cpow(sf[16], 2.0)*cpow(sf[3], 3.0)*cpow(sf[9], 2.0))) + mu_Gex[10];
         
         d->sum_apep = 0.0;
         for (int i = 0; i < n_em; i++){
    @@ -9076,192 +5068,90 @@ 

    Source code for objective_functions.c

         }
     
         return d->df;
    -};
    - +}
    -
    [docs]/** - Objective function of ilm -*/ -double obj_ig_ilm(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_ig_ilm(SS_ref_db,x); - - for (int i = 0; i < n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); - it += 1; - } - } - } - - sf[0] = -0.5*x[0]*x[1] + 0.5*x[0] + 0.5*x[2]; - sf[1] = 0.5*x[0] - 0.5*x[3]; - sf[2] = 1.0 - x[0]; - sf[3] = 0.5*x[0]*x[1] - 0.5*x[2] + 0.5*x[3]; - sf[4] = -0.5*x[0]*x[1] + 0.5*x[0] - 0.5*x[2]; - sf[5] = 0.5*x[0] + 0.5*x[3]; - sf[6] = 1.0 - x[0]; - sf[7] = 0.5*x[0]*x[1] + 0.5*x[2] - 0.5*x[3]; - - - mu[0] = gb[0] + R*T*creal(clog(sqrt(sf[0])*sqrt(sf[5]))) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(2.0*cpow(sf[0], 0.25)*cpow(sf[1], 0.25)*cpow(sf[4], 0.25)*cpow(sf[5], 0.25))) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sqrt(sf[2])*sqrt(sf[6]) + d_em[2])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sqrt(sf[3])*sqrt(sf[5]))) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(2.0*cpow(sf[1], 0.25)*cpow(sf[3], 0.25)*cpow(sf[5], 0.25)*cpow(sf[7], 0.25))) + mu_Gex[4]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_ig_ilm(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } + +
    [docs]/** + objective function of ilmenite +*/ +double obj_ig_ilm(unsigned n, const double *x, double *grad, void *SS_ref_db) { - return d->df; -}
    - + SS_ref *d = (SS_ref *) SS_ref_db; - -
    [docs]/** - Objective function of liqHw -*/ -double obj_ig_liq(unsigned n, const double *x, double *grad, void *SS_ref_db){ - SS_ref *d = (SS_ref *) SS_ref_db; - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; + int n_em = d->n_em; + double P = d->P; + double T = d->T; + double R = d->R; - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_ig_liq(SS_ref_db,x); + double *gb = d->gb_lvl; + double *mat_phi= d->mat_phi; + double *mu_Gex = d->mu_Gex; + double *sf = d->sf; + double *mu = d->mu; + double *d_em = d->d_em; - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = - x[6] - x[3] - x[2] - x[10] - x[5] - x[4] - x[8] - x[1] - x[7] - x[0] + 0.25*x[9]*(-3.0*x[6] - 3.0*x[3] - 3.0*x[2] - 3.0*x[10] - 3.0*x[5] - 3.0*x[4] - 3.0*x[8] - 3.0*x[1] - 3.0*x[7] - 3.0*x[0] + 4.0) + 1.0; - sf[1] = 0.75*x[1]*x[9] + x[1] - x[9]; - sf[2] = 0.75*x[0]*x[9] + x[0] - x[9]; - sf[3] = 0.75*x[4]*x[9] + x[4]; - sf[4] = 0.75*x[5]*x[9] + x[5]; - sf[5] = 0.75*x[6]*x[9] + x[6]; - sf[6] = 0.75*x[7]*x[9] + x[7]; - sf[7] = 0.75*x[8]*x[9] + x[8]; - sf[8] = x[9]; - sf[9] = x[3] + x[2] + 0.75*x[9]*(x[3] + x[2]); - sf[10] = -0.75*x[10]*x[9] - x[10] + 1.0; - sf[11] = 4.0*x[2]*(0.75*x[9] + 1.0); - sf[12] = 4.0*x[3]*(0.75*x[9] + 1.0); - sf[13] = x[0]*(0.75*x[9] + 1.0) - x[9]; - sf[14] = x[1]*(0.75*x[9] + 1.0) - x[9]; - sf[15] = -2.0*x[9] + (0.75*x[9] + 1.0)*(4.0*x[3] + 4.0*x[2] + x[1] + x[0]); - sf[16] = x[10]*(0.75*x[9] + 1.0); - sf[17] = -0.75*x[10]*x[9] - x[10] + 1.0; - - - mu[0] = R*T*creal(clog(sf[0]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[0] + mu_Gex[0]; - mu[1] = R*T*creal(clog(sf[14]*sf[1]*1.0/sf[15]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[1] + mu_Gex[1]; - mu[2] = R*T*creal(clog(sf[13]*sf[2]*1.0/sf[15]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[2] + mu_Gex[2]; - mu[3] = R*T*creal(clog(cpow(sf[11], 4.0)*sf[9]*cpow(sf[15], -4.0)*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[3] + mu_Gex[3]; - mu[4] = R*T*creal(clog(cpow(sf[12], 4.0)*sf[9]*cpow(sf[15], -4.0)*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[4] + mu_Gex[4]; - mu[5] = R*T*creal(clog(sf[3]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[5] + mu_Gex[5]; - mu[6] = R*T*creal(clog(sf[4]*1.0/sf[10]*cpow(sf[17], 2.0) + d_em[6])) + gb[6] + mu_Gex[6]; - mu[7] = R*T*creal(clog(sf[5]*1.0/sf[10]*cpow(sf[17], 2.0) + d_em[7])) + gb[7] + mu_Gex[7]; - mu[8] = R*T*creal(clog(sf[6]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[8] + mu_Gex[8]; - mu[9] = R*T*creal(clog(sf[7]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[9] + mu_Gex[9]; - mu[10] = R*T*creal(clog(sf[8]*1.0/sf[10]*cpow(sf[17], 2.0))) + gb[10] + mu_Gex[10]; - mu[11] = R*T*creal(clog(cpow(sf[16], 2.0))) + gb[11] + mu_Gex[11]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; + px_ig_ilm(SS_ref_db,x); - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; + for (int i = 0; i < d->n_em; i++){ + mu_Gex[i] = 0.0; + int it = 0; + for (int j = 0; j < d->n_xeos; j++){ + for (int k = j+1; k < d->n_em; k++){ + mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]); + it += 1; + } + } + } + + sf[0] = 0.5*x[1] + 0.5*x[0]; + sf[1] = -0.5*x[1] + 0.5*x[0]; + sf[2] = 1.0 - x[0]; + sf[3] = -0.5*x[1] + 0.5*x[0]; + sf[4] = 0.5*x[1] + 0.5*x[0]; + sf[5] = 1.0 - x[0]; - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_ig_liq(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } + mu[0] = R*T*creal(clog(csqrt(sf[0])*csqrt(sf[4]))) + gb[0] + mu_Gex[0]; + mu[1] = R*T*creal(clog(2.0*cpow(sf[0], 0.25)*cpow(sf[1], 0.25)*cpow(sf[3], 0.25)*cpow(sf[4], 0.25))) + gb[1] + mu_Gex[1]; + mu[2] = R*T*creal(clog(csqrt(sf[2])*csqrt(sf[5]) + d_em[2])) + gb[2] + mu_Gex[2]; - return d->df; -}
    + d->sum_apep = 0.0; + for (int i = 0; i < n_em; i++){ + d->sum_apep += d->ape[i]*d->p[i]; + } + d->factor = d->fbc/d->sum_apep; + d->df_raw = 0.0; + for (int i = 0; i < d->n_em; i++){ + d->df_raw += mu[i]*d->p[i]; + } + d->df = d->df_raw * d->factor; + + if (grad){ + double *dfx = d->dfx; + double **dp_dx = d->dp_dx; + dpdx_ig_ilm(SS_ref_db,x); + for (int i = 0; i < (d->n_xeos); i++){ + dfx[i] = 0.0; + for (int j = 0; j < n_em; j++){ + dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; + } + grad[i] = creal(dfx[i]); + } + } -
    [docs]/** - objective function of muscovite + return d->df; +};
    + +
    [docs]/** + objective function of liquid */ -double obj_ig_mu(unsigned n, const double *x, double *grad, void *SS_ref_db) { +double obj_ig_liq(unsigned n, const double *x, double *grad, void *SS_ref_db) { SS_ref *d = (SS_ref *) SS_ref_db; - + double muGex; int n_em = d->n_em; double P = d->P; double T = d->T; @@ -9272,9 +5162,9 @@

    Source code for objective_functions.c

     	double *mu_Gex = d->mu_Gex;
     	double *sf     = d->sf;
     	double *mu     = d->mu;
    -
    -	px_ig_mu(SS_ref_db,x);
    -
    +    double *d_em   = d->d_em;
    +	px_ig_liq(SS_ref_db,x);
    +	
     	d->sum_v = 0.0;
     	for (int i = 0; i < d->n_em; i++){
     		d->sum_v += d->p[i]*d->v[i];
    @@ -9284,33 +5174,48 @@ 

    Source code for objective_functions.c

     	}
     
     	for (int i = 0; i < d->n_em; i++){
    -		mu_Gex[i] = 0.0;
    +		muGex = 0.0;
     		int it = 0;
     		for (int j = 0; j < d->n_xeos; j++){
     			for (int k = j+1; k < d->n_em; k++){
    -				mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k]));
    +				muGex -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k]));
     				it += 1;
     			}
     		}
    +        mu_Gex[i] = muGex;
     	}
    -	
    -    sf[0]           = -x[4] - x[3] + 1.0;
    -    sf[1]           = x[3];
    -    sf[2]           = x[4];
    -    sf[3]           = x[0]*x[1] - x[0] - x[1] + 1.0;
    -    sf[4]           = -x[0]*x[1] + x[0];
    -    sf[5]           = x[1];
    -    sf[6]           = 1.0 - x[2];
    -    sf[7]           = x[2];
    -    sf[8]           = -0.5*x[4] - 0.5*x[1] + 1.0;
    -    sf[9]           = 0.5*x[4] + 0.5*x[1];
    -	
    -	mu[0]          = R*T*creal(clog(4.0*sf[0]*sf[5]*sf[6]*sf[8]*sf[9]))  + gb[0] + mu_Gex[0];
    -	mu[1]          = R*T*creal(clog(sf[0]*sf[3]*sf[6]* pow(sf[8], 2.0))) + gb[1] + mu_Gex[1];
    -	mu[2]          = R*T*creal(clog(sf[0]*sf[4]*sf[6]* pow(sf[8], 2.0))) + gb[2] + mu_Gex[2];
    -	mu[3]          = R*T*creal(clog(4.0*sf[1]*sf[5]*sf[6]*sf[8]*sf[9]))  + gb[3] + mu_Gex[3];
    -	mu[4]          = R*T*creal(clog(sf[2]*sf[5]*sf[6]* pow(sf[9], 2.0))) + gb[4] + mu_Gex[4];
    -	mu[5]          = R*T*creal(clog(4.0*sf[0]*sf[5]*sf[7]*sf[8]*sf[9]))  + gb[5] + mu_Gex[5];
    +
    +	sf[0]           = -x[6] - x[3] - x[2] - x[10] - x[5] - x[4] - x[8] - x[1] - x[7] - x[0] + 0.25*x[9]*(-3.0*x[6] - 3.0*x[3] - 3.0*x[2] - 3.0*x[10] - 3.0*x[5] - 3.0*x[4] - 3.0*x[8] - 3.0*x[1] - 3.0*x[7] - 3.0*x[0] + 4.0) + 1.0;
    +	sf[1]           = 0.75*x[1]*x[9] + x[1] - x[9];
    +	sf[2]           = 0.75*x[0]*x[9] + x[0] - x[9];
    +	sf[3]           = 0.75*x[4]*x[9] + x[4];
    +	sf[4]           = 0.75*x[5]*x[9] + x[5];
    +	sf[5]           = 0.75*x[6]*x[9] + x[6];
    +	sf[6]           = 0.75*x[7]*x[9] + x[7];
    +	sf[7]           = 0.75*x[8]*x[9] + x[8];
    +	sf[8]           = x[9];
    +	sf[9]           = x[3] + x[2] + 0.75*x[9]*(x[3] + x[2]);
    +	sf[10]          = -0.75*x[10]*x[9] - x[10] + 1.0;
    +	sf[11]          = 4.0*x[2];
    +	sf[12]          = 4.0*x[3];
    +	sf[13]          = x[0];
    +	sf[14]          = x[1];
    +	sf[15]          = 4.0*x[3] + 4.0*x[2] + x[1] + x[0];
    +	sf[16]          = x[10];
    +	sf[17]          = 1.0 - x[10];
    +
    +	mu[0]         = R*T*creal(clog( sf[0]*1.0/sf[10]*pow(sf[17], 2.0))) 					+ gb[0] + mu_Gex[0];
    +	mu[1]         = R*T*creal(clog( 1.0/sf[10]*sf[14]*1.0/sf[15]*pow(sf[17], 2.0)*sf[1])) 	+ gb[1] + mu_Gex[1];
    +	mu[2]         = R*T*creal(clog( 1.0/sf[10]*sf[13]*1.0/sf[15]*pow(sf[17], 2.0)*sf[2])) 	+ gb[2] + mu_Gex[2];
    +	mu[3]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[11], 4.0)* (1./pow(sf[15], 4.0))*pow(sf[17], 2.0)*sf[9])) + gb[3] + mu_Gex[3];
    +	mu[4]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[12], 4.0)* (1./pow(sf[15], 4.0))*pow(sf[17], 2.0)*sf[9])) + gb[4] + mu_Gex[4];
    +	mu[5]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[3])) 					+ gb[5] + mu_Gex[5];
    +	mu[6]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[4] + d_em[6])) 			+ gb[6] + mu_Gex[6];
    +	mu[7]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[5] + d_em[7])) 			+ gb[7] + mu_Gex[7];
    +	mu[8]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[6])) 					+ gb[8] + mu_Gex[8];
    +	mu[9]         = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[7])) 					+ gb[9] + mu_Gex[9];
    +	mu[10]        = R*T*creal(clog( 1.0/sf[10]*pow(sf[17], 2.0)*sf[8])) 					+ gb[10] + mu_Gex[10];
    +	mu[11]        = R*T*creal(clog( pow(sf[16], 2.0))) 										+ gb[11] + mu_Gex[11];
     
     	d->sum_apep = 0.0;
     	for (int i = 0; i < n_em; i++){
    @@ -9327,7 +5232,7 @@ 

    Source code for objective_functions.c

     	if (grad){
     	double *dfx    = d->dfx;
     	double **dp_dx = d->dp_dx;
    -		dpdx_ig_mu(SS_ref_db,x);
    +		dpdx_ig_liq(SS_ref_db,x);
     		for (int i = 0; i < (d->n_xeos); i++){
     		   dfx[i] = 0.0;
     		   for (int j = 0; j < n_em; j++){
    @@ -9340,6 +5245,7 @@ 

    Source code for objective_functions.c

     	return d->df;
     };
    +
    [docs]/** objective function of olivine */ @@ -9371,16 +5277,108 @@

    Source code for objective_functions.c

     			}
     		}
     	}
    -    sf[0]          =  x[2] - x[0] + 1.0;
    -    sf[1]          = -x[2] + x[0];
    -    sf[2]          =  x[1]*x[0] - x[1] - x[2] - x[0] + 1.0;
    -    sf[3]          = -x[1]*x[0] + x[2] + x[0];
    -    sf[4]          =  x[1];
    -    
    -	mu[0]          = R*T*creal(clog(sf[0]*sf[4])) + gb[0] + mu_Gex[0];
    -	mu[1]          = R*T*creal(clog(sf[1]*sf[3])) + gb[1] + mu_Gex[1];
    -	mu[2]          = R*T*creal(clog(sf[0]*sf[2])) + gb[2] + mu_Gex[2];
    -	mu[3]          = R*T*creal(clog(sf[0]*sf[3])) + gb[3] + mu_Gex[3];
    +    sf[0]          =  x[2] - x[0] + 1.0;
    +    sf[1]          = -x[2] + x[0];
    +    sf[2]          =  x[1]*x[0] - x[1] - x[2] - x[0] + 1.0;
    +    sf[3]          = -x[1]*x[0] + x[2] + x[0];
    +    sf[4]          =  x[1];
    +    
    +	mu[0]          = R*T*creal(clog(sf[0]*sf[4])) + gb[0] + mu_Gex[0];
    +	mu[1]          = R*T*creal(clog(sf[1]*sf[3])) + gb[1] + mu_Gex[1];
    +	mu[2]          = R*T*creal(clog(sf[0]*sf[2])) + gb[2] + mu_Gex[2];
    +	mu[3]          = R*T*creal(clog(sf[0]*sf[3])) + gb[3] + mu_Gex[3];
    +
    +	d->sum_apep = 0.0;
    +	for (int i = 0; i < n_em; i++){
    +	   d->sum_apep += d->ape[i]*d->p[i];
    +	}
    +	d->factor = d->fbc/d->sum_apep;
    +
    +	d->df_raw = 0.0;
    +	for (int i = 0; i < d->n_em; i++){
    +		d->df_raw += mu[i]*d->p[i];
    +	}
    +	d->df = d->df_raw * d->factor;
    +	
    +	if (grad){
    +	double *dfx    = d->dfx;
    +	double **dp_dx = d->dp_dx;
    +		dpdx_ig_ol(SS_ref_db,x);
    +		for (int i = 0; i < (d->n_xeos); i++){
    +		   dfx[i] = 0.0;
    +		   for (int j = 0; j < n_em; j++){
    +			   dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    +		   }
    +		   grad[i] = creal(dfx[i]);
    +		}
    +	}
    +
    +	return d->df;
    +};
    + +
    [docs]/** + objective function of orthopyroxene +*/ +double obj_ig_opx(unsigned n, const double *x, double *grad, void *SS_ref_db) { + + SS_ref *d = (SS_ref *) SS_ref_db; + + + int n_em = d->n_em; + double P = d->P; + double T = d->T; + double R = d->R; + + double *gb = d->gb_lvl; + double *mat_phi= d->mat_phi; + double *mu_Gex = d->mu_Gex; + double *sf = d->sf; + double *mu = d->mu; + double *d_em = d->d_em; + + px_ig_opx(SS_ref_db,x); + + d->sum_v = 0.0; + for (int i = 0; i < d->n_em; i++){ + d->sum_v += d->p[i]*d->v[i]; + } + for (int i = 0; i < d->n_em; i++){ + d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; + } + + for (int i = 0; i < d->n_em; i++){ + mu_Gex[i] = 0.0; + int it = 0; + for (int j = 0; j < d->n_xeos; j++){ + for (int k = j+1; k < d->n_em; k++){ + mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); + it += 1; + } + } + } + + sf[0] = x[7]*x[3] + x[7]*x[0] - x[7] - x[3]*x[5] + x[3]*x[1] - x[3] - x[5]*x[0] + x[5] + x[0]*x[1] - x[0] - x[1] + 1.0; + sf[1] = -x[7]*x[3] - x[7]*x[0] + x[3]*x[5] - x[3]*x[1] + x[3] + x[5]*x[0] - x[0]*x[1] + x[0]; + sf[2] = -x[6] - x[4] + x[7] - 2.0*x[5] + x[1]; + sf[3] = x[4]; + sf[4] = x[6]; + sf[5] = x[5]; + sf[6] = x[2]*x[0] - x[2] - x[7]*x[3] + x[7]*x[0] - x[7] + x[3]*x[5] - x[3]*x[1] + x[3] - x[0] + 1.0; + sf[7] = -x[2]*x[0] + x[7]*x[3] - x[7]*x[0] - x[3]*x[5] + x[3]*x[1] - x[3] + x[0]; + sf[8] = x[2]; + sf[9] = x[7]; + sf[10] = 1.0 - 0.5*x[1]; + sf[11] = 0.5*x[1]; + + mu[0] = R*T*creal(clog(sf[0]*csqrt(sf[10])*sf[6])) + gb[0] + mu_Gex[0]; + mu[1] = R*T*creal(clog(csqrt(sf[10])*sf[1]*sf[7])) + gb[1] + mu_Gex[1]; + mu[2] = R*T*creal(clog(sf[0]*csqrt(sf[10])*sf[7])) + gb[2] + mu_Gex[2]; + mu[3] = R*T*creal(clog(sf[0]*csqrt(sf[10])*sf[8])) + gb[3] + mu_Gex[3]; + mu[4] = R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[2]*sf[6])) + gb[4] + mu_Gex[4]; + mu[5] = R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[4]*sf[6] + d_em[5])) + gb[5] + mu_Gex[5]; + mu[6] = R*T*creal(clog(2.8284*csqrt(sf[0])*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*csqrt(sf[5])*sf[6])) + gb[6] + mu_Gex[6]; + mu[7] = R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[3]*sf[6] + d_em[7])) + gb[7] + mu_Gex[7]; + mu[8] = R*T*creal(clog(csqrt(sf[10])*sf[2]*sf[9])) + gb[8] + mu_Gex[8]; d->sum_apep = 0.0; for (int i = 0; i < n_em; i++){ @@ -9397,7 +5395,7 @@

    Source code for objective_functions.c

     	if (grad){
     	double *dfx    = d->dfx;
     	double **dp_dx = d->dp_dx;
    -		dpdx_ig_ol(SS_ref_db,x);
    +		dpdx_ig_opx(SS_ref_db,x);
     		for (int i = 0; i < (d->n_xeos); i++){
     		   dfx[i] = 0.0;
     		   for (int j = 0; j < n_em; j++){
    @@ -9410,95 +5408,6 @@ 

    Source code for objective_functions.c

     	return d->df;
     };
    -
    [docs]/** - objective function of orthopyroxene -*/ -double obj_ig_opx(unsigned n, const double *x, double *grad, void *SS_ref_db) { - SS_ref *d = (SS_ref *) SS_ref_db; - - int n_em = d->n_em; - double P = d->P; - double T = d->T; - double R = d->R; - - double *gb = d->gb_lvl; - double *mat_phi = d->mat_phi; - double *mu_Gex = d->mu_Gex; - double *sf = d->sf; - double *mu = d->mu; - double *d_em = d->d_em; - px_ig_opx(SS_ref_db,x); - - d->sum_v = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_v += d->p[i]*d->v[i]; - } - for (int i = 0; i < n_em; i++){ - d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v; - } - - for (int i = 0; i < d->n_em; i++){ - mu_Gex[i] = 0.0; - int it = 0; - for (int j = 0; j < d->n_xeos; j++){ - for (int k = j+1; k < d->n_em; k++){ - mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k])); - it += 1; - } - } - } - - sf[0] = x[0]*x[1] - x[0]*x[5] + x[0]*x[7] - x[0] + x[1]*x[3] - x[1] - x[3]*x[5] + x[3]*x[7] - x[3] + x[5] - x[7] + 1.0; - sf[1] = -x[0]*x[1] + x[0]*x[5] - x[0]*x[7] + x[0] - x[1]*x[3] + x[3]*x[5] - x[3]*x[7] + x[3]; - sf[2] = x[1] - x[4] - 2.0*x[5] - x[6] + x[7]; - sf[3] = x[4]; - sf[4] = x[6]; - sf[5] = x[5]; - sf[6] = x[0]*x[2] + x[0]*x[7] - x[0] - x[1]*x[3] - x[2] + x[3]*x[5] - x[3]*x[7] + x[3] - x[7] + 1.0; - sf[7] = -x[0]*x[2] - x[0]*x[7] + x[0] + x[1]*x[3] - x[3]*x[5] + x[3]*x[7] - x[3]; - sf[8] = x[2]; - sf[9] = x[7]; - sf[10] = 1.0 - 0.5*x[1]; - sf[11] = 0.5*x[1]; - - - mu[0] = gb[0] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[6])) + mu_Gex[0]; - mu[1] = gb[1] + R*T*creal(clog(sqrt(sf[10])*sf[1]*sf[7])) + mu_Gex[1]; - mu[2] = gb[2] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[7])) + mu_Gex[2]; - mu[3] = gb[3] + R*T*creal(clog(sf[0]*sqrt(sf[10])*sf[8])) + mu_Gex[3]; - mu[4] = gb[4] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[2]*sf[6])) + mu_Gex[4]; - mu[5] = gb[5] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[4]*sf[6] + d_em[5])) + mu_Gex[5]; - mu[6] = gb[6] + R*T*creal(clog(2.8284*sqrt(sf[0])*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sqrt(sf[5])*sf[6])) + mu_Gex[6]; - mu[7] = gb[7] + R*T*creal(clog(1.4142*cpow(sf[10], 0.25)*cpow(sf[11], 0.25)*sf[3]*sf[6] + d_em[7])) + mu_Gex[7]; - mu[8] = gb[8] + R*T*creal(clog(sqrt(sf[10])*sf[2]*sf[9])) + mu_Gex[8]; - - d->sum_apep = 0.0; - for (int i = 0; i < n_em; i++){ - d->sum_apep += d->ape[i]*d->p[i]; - } - d->factor = d->fbc/d->sum_apep; - - d->df_raw = 0.0; - for (int i = 0; i < n_em; i++){ - d->df_raw += mu[i]*d->p[i]; - } - d->df = d->df_raw * d->factor; - - if (grad){ - double *dfx = d->dfx; - double **dp_dx = d->dp_dx; - dpdx_ig_opx(SS_ref_db,x); - for (int i = 0; i < (d->n_xeos); i++){ - dfx[i] = 0.0; - for (int j = 0; j < n_em; j++){ - dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i]; - } - grad[i] = creal(dfx[i]); - } - } - - return d->df; -}
    [docs]/** objective function of plagioclase 4T @@ -9582,87 +5491,80 @@

    Source code for objective_functions.c

       objective function of spinel
     */
     double obj_ig_spn(unsigned n, const double *x, double *grad, void *SS_ref_db) {
    -    SS_ref *d         = (SS_ref *) SS_ref_db;
    + 
    +	SS_ref *d  = (SS_ref *) SS_ref_db;
     
    -    int n_em          = d->n_em;
    -    double P          = d->P;
    -    double T          = d->T;
    -    double R          = d->R;
    +	int n_em   = d->n_em;
    +	double P   = d->P;
    +	double T   = d->T;
    +	double R   = d->R;
     
    -    double *gb        = d->gb_lvl;
    -    double *mat_phi   = d->mat_phi;
    -    double *mu_Gex    = d->mu_Gex;
    -    double *sf        = d->sf;
    -    double *mu        = d->mu;
    -    double *d_em      = d->d_em;
    -    px_ig_spn(SS_ref_db,x);
    +	double *gb     = d->gb_lvl;
    +	double *mat_phi= d->mat_phi;
    +	double *mu_Gex = d->mu_Gex;
    +	double *sf     = d->sf;
    +	double *mu     = d->mu;
    +    double *d_em   = d->d_em;
     
    -    d->sum_v = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->sum_v += d->p[i]*d->v[i];
    -    }
    -    for (int i = 0; i < n_em; i++){
    -        d->mat_phi[i] = (d->p[i]*d->v[i])/d->sum_v;
    -    }
    -    
    -    for (int i = 0; i < d->n_em; i++){
    -        mu_Gex[i] = 0.0;
    -        int it = 0;
    -        for (int j = 0; j < d->n_xeos; j++){
    -            for (int k = j+1; k < d->n_em; k++){
    -                mu_Gex[i] -= (d->eye[i][j] - d->mat_phi[j])*(d->eye[i][k] - d->mat_phi[k])*(d->W[it]*2.0*d->v[i]/(d->v[j]+d->v[k]));
    -                it += 1;
    -            }
    -        }
    -    }
    -    
    -    sf[0]          = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] + 2.0/3.0*x[4] + 1.0/3.0;
    -    sf[1]          = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] + 2.0/3.0*x[5];
    -    sf[2]          = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - 1.0/3.0*x[3] - 2.0/3.0*x[4] - 2.0/3.0*x[5] - 2.0/3.0*x[6] + 2.0/3.0;
    -    sf[3]          = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] + 2.0/3.0*x[6];
    -    sf[4]          = -1.0/3.0*x[0]*x[3] - 1.0/3.0*x[0] + 1.0/3.0*x[3] - 1.0/3.0*x[4] + 1.0/3.0;
    -    sf[5]          = 1.0/3.0*x[0]*x[3] + 1.0/3.0*x[0] - 1.0/3.0*x[5];
    -    sf[6]          = 2.0/3.0*x[1]*x[2] + 2.0/3.0*x[1]*x[3] - 2.0/3.0*x[1] - x[2] - 5.0/6.0*x[3] + 1.0/3.0*x[4] + 1.0/3.0*x[5] + 1.0/3.0*x[6] + 2.0/3.0;
    -    sf[7]          = -2.0/3.0*x[1]*x[2] - 2.0/3.0*x[1]*x[3] + 2.0/3.0*x[1] - 1.0/3.0*x[6];
    -    sf[8]          = x[2];
    -    sf[9]          = 0.5*x[3];
    -    
    -    
    -    mu[0]          = gb[0] + R*T*creal(clog(sf[0]*sf[6])) + mu_Gex[0];
    -    mu[1]          = gb[1] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[4])*sqrt(sf[6]))) + mu_Gex[1];
    -    mu[2]          = gb[2] + R*T*creal(clog(sf[1]*sf[6])) + mu_Gex[2];
    -    mu[3]          = gb[3] + R*T*creal(clog(2.0*sf[2]*sqrt(sf[5])*sqrt(sf[6]))) + mu_Gex[3];
    -    mu[4]          = gb[4] + R*T*creal(clog(sf[1]*sf[7] + d_em[4])) + mu_Gex[4];
    -    mu[5]          = gb[5] + R*T*creal(clog(2.0*sf[3]*sqrt(sf[5])*sqrt(sf[7]) + d_em[5])) + mu_Gex[5];
    -    mu[6]          = gb[6] + R*T*creal(clog(sf[0]*sf[8] + d_em[6])) + mu_Gex[6];
    -    mu[7]          = gb[7] + R*T*creal(clog(2.0*sf[1]*sqrt(sf[5])*sqrt(sf[9]))) + mu_Gex[7];
    -    
    -    d->sum_apep = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->sum_apep += d->ape[i]*d->p[i];
    -    }
    -    d->factor = d->fbc/d->sum_apep;
    +	px_ig_spn(SS_ref_db,x);
     
    -    d->df_raw = 0.0;
    -    for (int i = 0; i < n_em; i++){
    -        d->df_raw += mu[i]*d->p[i];
    -    }
    -    d->df = d->df_raw * d->factor;
    +	for (int i = 0; i < d->n_em; i++){
    +		mu_Gex[i] = 0.0;
    +		int it = 0;
    +		for (int j = 0; j < d->n_xeos; j++){
    +			for (int k = j+1; k < d->n_em; k++){
    +				mu_Gex[i] -= (d->eye[i][j] - d->p[j])*(d->eye[i][k] - d->p[k])*(d->W[it]);
    +				it += 1;
    +			}
    +		}
    +	}
    +	
    +    sf[0]           = 2.0*x[4]/3.0 -x[3]*x[0]/3.0 +x[3]/3.0 -x[0]/3.0 + 1.0/3.0;
    +    sf[1]           = 2.0*x[5]/3.0 +x[3]*x[0]/3.0 +x[0]/3.0;
    +    sf[2]           = -2.0*x[4]/3.0 - 2.0*x[5]/3.0 - 2.0*x[6]/3.0 + 2.0*x[2]*x[1]/3.0 + 2.0*x[3]*x[1]/3.0 - x[3]/3.0 - 2.0*x[1]/3.0 + 2.0/3.0;
    +    sf[3]           = 2.0*x[6]/3.0 - 2.0*x[2]*x[1]/3.0 - 2.0*x[3]*x[1]/3.0 + 2.0*x[1]/3.0;
    +    sf[4]           = -x[4]/3.0 -x[3]*x[0]/3.0 +x[3]/3.0 -x[0]/3.0 + 1.0/3.0;
    +    sf[5]           = -x[5]/3.0 +x[3]*x[0]/3.0 +x[0]/3.0;
    +    sf[6]           = x[4]/3.0 +x[5]/3.0 +x[6]/3.0 + 2.0*x[2]*x[1]/3.0 -x[2] + 2.0*x[3]*x[1]/3.0 - 5.0*x[3]/6.0 - 2.0*x[1]/3.0 + 2.0/3.0;
    +    sf[7]           = -x[6]/3.0 - 2.0*x[2]*x[1]/3.0 - 2.0*x[3]*x[1]/3.0 + 2.0*x[1]/3.0;
    +    sf[8]           = x[2];
    +    sf[9]           = 0.5*x[3];
    +
    +	mu[0]          = R*T*creal(clog(sf[0]*sf[6])) + gb[0] + mu_Gex[0];
    +	mu[1]          = R*T*creal(clog(2.0*sf[2]*csqrt(sf[4])*csqrt(sf[6]))) + gb[1] + mu_Gex[1];
    +	mu[2]          = R*T*creal(clog(sf[1]*sf[6])) + gb[2] + mu_Gex[2];
    +	mu[3]          = R*T*creal(clog(2.0*sf[2]*csqrt(sf[5])*csqrt(sf[6]))) + gb[3] + mu_Gex[3];
    +	mu[4]          = R*T*creal(clog(sf[1]*sf[7] + d_em[4])) + gb[4] + mu_Gex[4];
    +	mu[5]          = R*T*creal(clog(2.0*sf[3]*csqrt(sf[5])*csqrt(sf[7]) + d_em[5])) + gb[5] + mu_Gex[5];
    +	mu[6]          = R*T*creal(clog(sf[0]*sf[8] + d_em[6])) + gb[6] + mu_Gex[6];
    +	mu[7]          = R*T*creal(clog(2.0*sf[0]*csqrt(sf[4])*csqrt(sf[9]))) + gb[7] + mu_Gex[7];
     
    -    if (grad){
    -        double *dfx    = d->dfx;
    -        double **dp_dx = d->dp_dx;
    -        dpdx_ig_spn(SS_ref_db,x);
    -        for (int i = 0; i < (d->n_xeos); i++){
    -            dfx[i] = 0.0;
    -            for (int j = 0; j < n_em; j++){
    -                dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    -            }
    -            grad[i] = creal(dfx[i]);
    -        }
    -    }
    +	d->sum_apep = 0.0;
    +	for (int i = 0; i < n_em; i++){
    +	   d->sum_apep += d->ape[i]*d->p[i];
    +	}
    +	d->factor = d->fbc/d->sum_apep;
     
    -    return d->df;
    +	d->df_raw = 0.0;
    +	for (int i = 0; i < d->n_em; i++){
    +		d->df_raw += mu[i]*d->p[i];
    +	}
    +	d->df = d->df_raw * d->factor;
    +	
    +	if (grad){
    +	double *dfx    = d->dfx;
    +	double **dp_dx = d->dp_dx;
    +		dpdx_ig_spn(SS_ref_db,x);
    +		for (int i = 0; i < (d->n_xeos); i++){
    +		   dfx[i] = 0.0;
    +		   for (int j = 0; j < n_em; j++){
    +			   dfx[i] += (mu[j] - (d->ape[j]/d->sum_apep)*d->df_raw)*d->factor*dp_dx[j][i];
    +		   }
    +		   grad[i] = creal(dfx[i]);
    +		}
    +	}
    +
    +	return d->df;
     }
    SS_ref P2X( global_variable gv, @@ -9730,6 +5632,9 @@

    Source code for objective_functions.c

     		if 	(strcmp( name, "bi") == 0 ){
     			p2x_ig_bi(&SS_ref_db, eps);	
     		}
    +		else if (strcmp( name, "fper")  == 0){
    +			p2x_ig_fper(&SS_ref_db, eps);	
    +		}
     		else if (strcmp( name, "cd")  == 0){
     			p2x_ig_cd(&SS_ref_db, eps);	
     		}
    @@ -9753,9 +5658,6 @@ 

    Source code for objective_functions.c

     		}
     		else if (strcmp( name, "liq") == 0){
     			p2x_ig_liq(&SS_ref_db, eps);
    -		}
    -		else if (strcmp( name, "mu")  == 0){
    -			p2x_ig_mu(&SS_ref_db, eps);	
     		}	
     		else if (strcmp( name, "ol")  == 0){
     			p2x_ig_ol(&SS_ref_db, eps);
    @@ -9772,108 +5674,7 @@ 

    Source code for objective_functions.c

     		else{
     			printf("\nsolid solution '%s' is not in the database\n",name);		
     		}	
    -
     	}
    -    else if (gv.EM_database == 3){
    -        if (strcmp( name, "liq") == 0 ){
    -            p2x_igd_liq(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "fl") == 0 ){
    -            p2x_igd_fl(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "fsp") == 0 ){
    -            p2x_igd_fsp(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "spn") == 0 ){
    -            p2x_igd_spn(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "g") == 0 ){
    -            p2x_igd_g(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ol") == 0 ){
    -            p2x_igd_ol(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "opx") == 0 ){
    -            p2x_igd_opx(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "cpx") == 0 ){
    -            p2x_igd_cpx(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ilm") == 0 ){
    -            p2x_igd_ilm(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "hb") == 0 ){
    -            p2x_igd_hb(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "bi") == 0 ){
    -            p2x_igd_bi(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ep") == 0 ){
    -            p2x_igd_ep(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "cd") == 0 ){
    -            p2x_igd_cd(&SS_ref_db, eps);
    -        }
    -        else{
    -            printf("\nsolid solution '%s' is not in the database\n",name);
    -        }
    -    }
    -    else if (gv.EM_database == 6){
    -        if (strcmp( name, "liq") == 0 ){
    -            p2x_alk_liq(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "fl") == 0 ){
    -            p2x_alk_fl(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "fsp") == 0 ){
    -            p2x_alk_fsp(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "spn") == 0 ){
    -            p2x_alk_spn(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "g") == 0 ){
    -            p2x_alk_g(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ol") == 0 ){
    -            p2x_alk_ol(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "opx") == 0 ){
    -            p2x_alk_opx(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "cpx") == 0 ){
    -            p2x_alk_cpx(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ilm") == 0 ){
    -            p2x_alk_ilm(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ness") == 0 ){
    -            p2x_alk_ness(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "lct") == 0 ){
    -            p2x_alk_lct(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "kals") == 0 ){
    -            p2x_alk_kals(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "mel") == 0 ){
    -            p2x_alk_mel(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "hb") == 0 ){
    -            p2x_alk_hb(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "bi") == 0 ){
    -            p2x_alk_bi(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "ep") == 0 ){
    -            p2x_alk_ep(&SS_ref_db, eps);
    -        }
    -        else if (strcmp( name, "cd") == 0 ){
    -            p2x_alk_cd(&SS_ref_db, eps);
    -        }
    -        else{
    -            printf("\nsolid solution '%s' is not in the database\n",name);
    -        }
    -    }
     	else if(gv.EM_database == 4){
     		if 	(strcmp( name, "fluid") == 0 ){
     			p2x_um_fluid(&SS_ref_db, eps);	
    @@ -9984,6 +5785,9 @@ 

    Source code for objective_functions.c

     		if 	(strcmp( name, "bi") == 0 ){
     			G0 = obj_ig_bi(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
     		}
    +		else if (strcmp( name, "fper")  == 0){
    +			G0 = obj_ig_fper(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
    +		}
     		else if (strcmp( name, "cd")  == 0){
     			G0 = obj_ig_cd(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
     		}
    @@ -10008,9 +5812,6 @@ 

    Source code for objective_functions.c

     		else if (strcmp( name, "liq") == 0){
     			G0 = obj_ig_liq(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
     		}
    -		else if (strcmp( name, "mu")  == 0){
    -			G0 = obj_ig_mu(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
    -		}	
     		else if (strcmp( name, "ol")  == 0){
     			G0 = obj_ig_ol(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
     		}
    @@ -10027,106 +5828,6 @@ 

    Source code for objective_functions.c

     			printf("\nsolid solution '%s' is not in the database\n",name);		
     		}	
     	}
    -    else if (gv.EM_database == 3){
    -        if (strcmp( name, "liq") == 0 ){
    -            G0 = obj_igd_liq(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "fl") == 0 ){
    -            G0 = obj_igd_fl(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "fsp") == 0 ){
    -            G0 = obj_igd_fsp(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "spn") == 0 ){
    -            G0 = obj_igd_spn(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "g") == 0 ){
    -            G0 = obj_igd_g(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ol") == 0 ){
    -            G0 = obj_igd_ol(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "opx") == 0 ){
    -            G0 = obj_igd_opx(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "cpx") == 0 ){
    -            G0 = obj_igd_cpx(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ilm") == 0 ){
    -            G0 = obj_igd_ilm(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "hb") == 0 ){
    -            G0 = obj_igd_hb(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "bi") == 0 ){
    -            G0 = obj_igd_bi(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ep") == 0 ){
    -            G0 = obj_igd_ep(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "cd") == 0 ){
    -            G0 = obj_igd_cd(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else{
    -            printf("\nsolid solution '%s' is not in the database\n",name);
    -        }
    -    }
    -    else if (gv.EM_database == 6){
    -        if (strcmp( name, "liq") == 0 ){
    -            G0 = obj_alk_liq(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "fl") == 0 ){
    -            G0 = obj_alk_fl(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "fsp") == 0 ){
    -            G0 = obj_alk_fsp(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "spn") == 0 ){
    -            G0 = obj_alk_spn(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "g") == 0 ){
    -            G0 = obj_alk_g(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ol") == 0 ){
    -            G0 = obj_alk_ol(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "opx") == 0 ){
    -            G0 = obj_alk_opx(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "cpx") == 0 ){
    -            G0 = obj_alk_cpx(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ilm") == 0 ){
    -            G0 = obj_alk_ilm(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ness") == 0 ){
    -            G0 = obj_alk_ness(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "lct") == 0 ){
    -            G0 = obj_alk_lct(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "kals") == 0 ){
    -            G0 = obj_alk_kals(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "mel") == 0 ){
    -            G0 = obj_alk_mel(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "hb") == 0 ){
    -            G0 = obj_alk_hb(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "bi") == 0 ){
    -            G0 = obj_alk_bi(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "ep") == 0 ){
    -            G0 = obj_alk_ep(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else if (strcmp( name, "cd") == 0 ){
    -            G0 = obj_alk_cd(SS_ref_db.n_xeos, SS_ref_db.iguess, SS_ref_db.dfx, &SS_ref_db);
    -        }
    -        else{
    -            printf("\nsolid solution '%s' is not in the database\n",name);
    -        }
    -    }
     	else if(gv.EM_database == 4){
     		if 	(strcmp( name, "fluid") == 0 ){
     			G0 = obj_um_fluid(SS_ref_db.n_xeos, SS_ref_db.iguess, 	SS_ref_db.dfx, &SS_ref_db);
    diff --git a/docs/_modules/phase_update_function.c.html b/docs/_modules/phase_update_function.c.html
    index 94646394..8c3ab9a4 100644
    --- a/docs/_modules/phase_update_function.c.html
    +++ b/docs/_modules/phase_update_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/_modules/pp_min_function.c.html b/docs/_modules/pp_min_function.c.html index 2fb92986..5267f266 100644 --- a/docs/_modules/pp_min_function.c.html +++ b/docs/_modules/pp_min_function.c.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -398,7 +407,7 @@

    Source code for pp_min_function.c

     				if (EM_database == 0){
     					printf("\n S   A   C   M   F   K   N   T   O   M   H  \n");
     				}
    -				else if (EM_database == 2 || EM_database == 3 || EM_database == 6){
    +				else if (EM_database == 2 || EM_database == 6){
     					printf("\n S   A   C   M   F   K   N   T   O   Cr  H  \n");
     				}
     				else if (EM_database == 4){
    diff --git a/docs/_modules/simplex_levelling.c.html b/docs/_modules/simplex_levelling.c.html
    index 4e859d6f..67870230 100644
    --- a/docs/_modules/simplex_levelling.c.html
    +++ b/docs/_modules/simplex_levelling.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -289,8 +298,6 @@

    Source code for simplex_levelling.c

     #include "PGE_function.h"
     #include "SS_xeos_PC_mp.h" 				//mp is first, it contains the structure definition
     #include "SS_xeos_PC_ig.h"
    -#include "SS_xeos_PC_igd.h"
    -#include "SS_xeos_PC_alk.h"
     #include "SS_xeos_PC_um.h"
     
     
    [docs]/** @@ -303,6 +310,8 @@

    Source code for simplex_levelling.c

     
     		if      (strcmp( gv.SS_list[iss], "bi")  == 0 ){
     			SS_objective[iss]  = obj_ig_bi; 		}
    +		else if (strcmp( gv.SS_list[iss], "fper")  == 0){
    +			SS_objective[iss]  = obj_ig_fper; 		}
     		else if (strcmp( gv.SS_list[iss], "cd")  == 0){
     			SS_objective[iss]  = obj_ig_cd; 		}
     		else if (strcmp( gv.SS_list[iss], "cpx") == 0){
    @@ -319,8 +328,6 @@ 

    Source code for simplex_levelling.c

     			SS_objective[iss]  = obj_ig_ilm; 		}
     		else if (strcmp( gv.SS_list[iss], "liq") == 0){
     			SS_objective[iss]  = obj_ig_liq; 		}
    -		else if (strcmp( gv.SS_list[iss], "mu")  == 0){
    -			SS_objective[iss]  = obj_ig_mu; 		}
     		else if (strcmp( gv.SS_list[iss], "ol")  == 0){
     			SS_objective[iss]  = obj_ig_ol; 		}
     		else if (strcmp( gv.SS_list[iss], "opx") == 0){
    @@ -334,122 +341,11 @@ 

    Source code for simplex_levelling.c

     		}	
     	};			
     }
    -
    [docs]/** - associate the array of pointer with the right solution phase -*/ -void SS_igd_objective_init_function(obj_type *SS_objective, - global_variable gv ){ - - for (int iss = 0; iss < gv.len_ss; iss++){ - if (strcmp( gv.SS_list[iss], "liq") == 0){ - SS_objective[iss] = obj_igd_liq; - } - else if (strcmp( gv.SS_list[iss], "fl") == 0){ - SS_objective[iss] = obj_igd_fl; - } - else if (strcmp( gv.SS_list[iss], "fsp") == 0){ - SS_objective[iss] = obj_igd_fsp; - } - else if (strcmp( gv.SS_list[iss], "spn") == 0){ - SS_objective[iss] = obj_igd_spn; - } - else if (strcmp( gv.SS_list[iss], "g") == 0){ - SS_objective[iss] = obj_igd_g; - } - else if (strcmp( gv.SS_list[iss], "ol") == 0){ - SS_objective[iss] = obj_igd_ol; - } - else if (strcmp( gv.SS_list[iss], "opx") == 0){ - SS_objective[iss] = obj_igd_opx; - } - else if (strcmp( gv.SS_list[iss], "cpx") == 0){ - SS_objective[iss] = obj_igd_cpx; - } - else if (strcmp( gv.SS_list[iss], "ilm") == 0){ - SS_objective[iss] = obj_igd_ilm; - } - else if (strcmp( gv.SS_list[iss], "hb") == 0){ - SS_objective[iss] = obj_igd_hb; - } - else if (strcmp( gv.SS_list[iss], "bi") == 0){ - SS_objective[iss] = obj_igd_bi; - } - else if (strcmp( gv.SS_list[iss], "ep") == 0){ - SS_objective[iss] = obj_igd_ep; - } - else if (strcmp( gv.SS_list[iss], "cd") == 0){ - SS_objective[iss] = obj_igd_cd; - } - else{ - printf("\nsolid solution '%s' is not in the database, cannot be initiated\n", gv.SS_list[iss]); - } - } -}
    -
    [docs]/** +
    [docs]/** associate the array of pointer with the right solution phase */ -void SS_alk_objective_init_function(obj_type *SS_objective, - global_variable gv ){ - - for (int iss = 0; iss < gv.len_ss; iss++){ - if (strcmp( gv.SS_list[iss], "liq") == 0){ - SS_objective[iss] = obj_alk_liq; - } - else if (strcmp( gv.SS_list[iss], "fl") == 0){ - SS_objective[iss] = obj_alk_fl; - } - else if (strcmp( gv.SS_list[iss], "fsp") == 0){ - SS_objective[iss] = obj_alk_fsp; - } - else if (strcmp( gv.SS_list[iss], "spn") == 0){ - SS_objective[iss] = obj_alk_spn; - } - else if (strcmp( gv.SS_list[iss], "g") == 0){ - SS_objective[iss] = obj_alk_g; - } - else if (strcmp( gv.SS_list[iss], "ol") == 0){ - SS_objective[iss] = obj_alk_ol; - } - else if (strcmp( gv.SS_list[iss], "opx") == 0){ - SS_objective[iss] = obj_alk_opx; - } - else if (strcmp( gv.SS_list[iss], "cpx") == 0){ - SS_objective[iss] = obj_alk_cpx; - } - else if (strcmp( gv.SS_list[iss], "ilm") == 0){ - SS_objective[iss] = obj_alk_ilm; - } - else if (strcmp( gv.SS_list[iss], "ness") == 0){ - SS_objective[iss] = obj_alk_ness; - } - else if (strcmp( gv.SS_list[iss], "lct") == 0){ - SS_objective[iss] = obj_alk_lct; - } - else if (strcmp( gv.SS_list[iss], "kals") == 0){ - SS_objective[iss] = obj_alk_kals; - } - else if (strcmp( gv.SS_list[iss], "mel") == 0){ - SS_objective[iss] = obj_alk_mel; - } - else if (strcmp( gv.SS_list[iss], "hb") == 0){ - SS_objective[iss] = obj_alk_hb; - } - else if (strcmp( gv.SS_list[iss], "bi") == 0){ - SS_objective[iss] = obj_alk_bi; - } - else if (strcmp( gv.SS_list[iss], "ep") == 0){ - SS_objective[iss] = obj_alk_ep; - } - else if (strcmp( gv.SS_list[iss], "cd") == 0){ - SS_objective[iss] = obj_alk_cd; - } - else{ - printf("\nsolid solution '%s' is not in the database, cannot be initiated\n", gv.SS_list[iss]); - } - } -}
    -
    [docs]void SS_mp_objective_init_function( obj_type *SS_objective, +void SS_mp_objective_init_function( obj_type *SS_objective, global_variable gv ){ for (int iss = 0; iss < gv.len_ss; iss++){ @@ -636,6 +532,7 @@

    Source code for simplex_levelling.c

     	dgetrf(&d->n_Ox, &d->n_Ox, d->Alu, &d->n_Ox, ipiv, &info);
     
     	char T = 'T';
    +
     	dgetrs(						&T,
     								&d->n_Ox, 
     								&nrhs, 
    @@ -1558,20 +1455,6 @@ 

    Source code for simplex_levelling.c

     											gv.SS_list[iss]				);
     		}
     	}
    -	else if (gv.EM_database == 3){
    -		for (iss = 0; iss < gv.len_ss; iss++){
    -			SS_igd_pc_init_function(		SS_pc_xeos, 
    -											iss,
    -											gv.SS_list[iss]				);
    -		}
    -	}
    -	else if (gv.EM_database == 6){
    -		for (iss = 0; iss < gv.len_ss; iss++){
    -			SS_alk_pc_init_function(		SS_pc_xeos, 
    -											iss,
    -											gv.SS_list[iss]				);
    -		}
    -	}
     	else if (gv.EM_database == 4){
     		for (iss = 0; iss < gv.len_ss; iss++){
     			SS_um_pc_init_function(			SS_pc_xeos, 
    @@ -1657,20 +1540,6 @@ 

    Source code for simplex_levelling.c

     											gv.SS_list[ss]				);
     		}
     	}
    -	else if (gv.EM_database == 3){
    -		for (ss = 0; ss < gv.len_ss; ss++){
    -			SS_igd_pc_init_function(		SS_pc_xeos, 
    -											ss,
    -											gv.SS_list[ss]				);
    -		}
    -	}
    -	else if (gv.EM_database == 6){
    -		for (ss = 0; ss < gv.len_ss; ss++){
    -			SS_alk_pc_init_function(		SS_pc_xeos, 
    -											ss,
    -											gv.SS_list[ss]				);
    -		}
    -	}
     	else if (gv.EM_database == 4){
     		for (ss = 0; ss < gv.len_ss; ss++){
     			SS_um_pc_init_function(			SS_pc_xeos, 
    diff --git a/docs/_modules/ss_min_function.c.html b/docs/_modules/ss_min_function.c.html
    index bcc3929c..f9c9fff7 100644
    --- a/docs/_modules/ss_min_function.c.html
    +++ b/docs/_modules/ss_min_function.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -751,44 +760,6 @@

    Source code for ss_min_function.c

     										/** can become a global variable instead */
     		}
     	}
    -	else if (EM_database == 3){
    -		for (int i = 0; i < gv.len_ss; i++){
    -			SS_ref_db[i].P  = z_b.P;									/** needed to pass to local minimizer, allows for P variation for liq/sol */
    -			SS_ref_db[i].T  = z_b.T;		
    -			SS_ref_db[i].R  = 0.0083144;
    -
    -			// if (SS_ref_db[i].is_liq == 1){
    -			// 	SS_ref_db[i].P  = z_b.P + gv.melt_pressure;
    -			// }
    -
    -			SS_ref_db[i]    = G_SS_igd_EM_function(	gv, 
    -													SS_ref_db[i], 
    -													EM_database, 
    -													z_b, 
    -													gv.SS_list[i]		);
    -											
    -										/** can become a global variable instead */
    -		}
    -	}
    -	else if (EM_database == 6){
    -		for (int i = 0; i < gv.len_ss; i++){
    -			SS_ref_db[i].P  = z_b.P;									/** needed to pass to local minimizer, allows for P variation for liq/sol */
    -			SS_ref_db[i].T  = z_b.T;		
    -			SS_ref_db[i].R  = 0.0083144;
    -
    -			// if (SS_ref_db[i].is_liq == 1){
    -			// 	SS_ref_db[i].P  = z_b.P + gv.melt_pressure;
    -			// }
    -
    -			SS_ref_db[i]    = G_SS_alk_EM_function(	gv, 
    -													SS_ref_db[i], 
    -													EM_database, 
    -													z_b, 
    -													gv.SS_list[i]		);
    -											
    -										/** can become a global variable instead */
    -		}
    -	}
     	else if (EM_database == 4 ){
     		for (int i = 0; i < gv.len_ss; i++){
     			SS_ref_db[i].P  = z_b.P;									/** needed to pass to local minimizer, allows for P variation for liq/sol */
    diff --git a/docs/_modules/toolkit.c.html b/docs/_modules/toolkit.c.html
    index 0657a01d..326d85c3 100644
    --- a/docs/_modules/toolkit.c.html
    +++ b/docs/_modules/toolkit.c.html
    @@ -128,6 +128,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -291,7 +300,7 @@

    Source code for toolkit.c

     	printf("  --Verb=       [int]   : Verbose option, 0. inactive, 1. active\n");	
     	printf("  --File=       [str]   : File name containing multiple point calculation\n");
     	printf("  --n_points=   [int]   : Number of points when using 'File' argument\n");
    -	printf("  --db=         [str]   : Database, can be 'mp', 'ig, 'igd' or 'um'*\n");
    +	printf("  --db=         [str]   : Database, can be 'mp', 'ig' or 'um'*\n");
     	printf("  --test=       [int]   : Number of points when using 'File' argument\n");
     	printf("  --Pres=       [float] : Pressure in kilobar\n");
     	printf("  --Temp=       [float] : Temperature in Celsius\n");
    @@ -301,12 +310,12 @@ 

    Source code for toolkit.c

     	printf("  --solver=     [int]   : solver: 0 for legacy and 1 for PGE (default)\n");
     	printf("  --out_matlab= [int]   : Matlab text file output, 0. inactive, 1. active\n");
     	printf("\n");
    -	printf(" * 'mp': metapelite, 'ig': igneous H18->G23, 'igd': igneous T21->G23, 'alk': igneous alkaline, 'um': ultramafic\n");
    +	printf(" * 'mp': metapelite, 'ig': igneous, 'um': ultramafic\n");
     	printf("\n");
     	printf(" **the list of oxides must be provided as follow:\n");
    -	printf("  'ig', 'igd', 'alk': SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O\n");
    -	printf("  'mp':               SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O\n");
    -	printf("  'um':               SiO2, Al2O3, MgO, FeOt, O, H2O, S\n");
    +	printf("  'ig': SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O\n");
    +	printf("  'mp': SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O\n");
    +	printf("  'um': SiO2, Al2O3, MgO, FeOt, O, H2O, S\n");
     	printf("\n");
     	printf(" Note that FeOt (total iron) is used here!\n");	
     	printf("\n\n");
    @@ -414,18 +423,12 @@ 

    Source code for toolkit.c

     			printf("  - Database                  : Metapelite (White et al., 2014)\n"	);
     		}
     		else if (gv.EM_database == 2){
    -			printf("  - Database                  : Igneous (Holland et al., 2018 -> Green et al., 2023)\n"	);
    -		}
    -		else if (gv.EM_database == 3){
    -			printf("  - Database                  : Igneous dry (Tomlinson & Holland, 2021 -> Green et al., 2023)\n"	);
    +			printf("  - Database                  : Igneous (Holland et al., 2018)\n"	);
     		}
     		else if (gv.EM_database == 4 ){
     			printf("  - Database                  : Ultramafic (Evans & Frost, 2021)\n"	);
     		}
    -		else if (gv.EM_database == 6){
    -			printf("  - Database                  : Igneous alkaline (Weller et al., 2023)\n"	);
    -		}
    -
    +		
     		if (strcmp( gv.sys_in, "mol") == 0){	
     			printf("  - input system composition  : mol fraction\n"	);
     		}
    diff --git a/docs/_sources/ckbk.rst.txt b/docs/_sources/ckbk.rst.txt
    index c340f9d2..3da684ae 100644
    --- a/docs/_sources/ckbk.rst.txt
    +++ b/docs/_sources/ckbk.rst.txt
    @@ -37,3 +37,11 @@ Pseudosection generator
        :maxdepth: 2
        
        ckbk/gui
    +
    +Predefined bulk-rocks
    +=====================
    +
    +.. toctree::
    +   :maxdepth: 2
    +   
    +   ckbk/predef
    diff --git a/docs/_sources/ckbk/predef.rst.txt b/docs/_sources/ckbk/predef.rst.txt
    new file mode 100644
    index 00000000..4359c7e2
    --- /dev/null
    +++ b/docs/_sources/ckbk/predef.rst.txt
    @@ -0,0 +1,9 @@
    +.. MAGEMin documentation
    +
    +List of pre-defined bulk-rock composition
    +=========================================
    +
    +.. csv-table:: Table Title
    +   :file: /figs/predefined_bulks.csv
    +   :widths: 10, 50, 10, 20, 20, 20
    +   :header-rows: 1
    \ No newline at end of file
    diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt
    index 52f15824..e98bbac8 100644
    --- a/docs/_sources/index.rst.txt
    +++ b/docs/_sources/index.rst.txt
    @@ -10,7 +10,7 @@
     
     |
     
    -**MAGEMin v1.3.2**
    +**MAGEMin v1.3.3**
     ==================
                                               
     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     
    diff --git a/docs/_sources/julia/Run.rst.txt b/docs/_sources/julia/Run.rst.txt
    index e0ce3751..2de4b236 100644
    --- a/docs/_sources/julia/Run.rst.txt
    +++ b/docs/_sources/julia/Run.rst.txt
    @@ -1,7 +1,7 @@
     .. MAGEMin documentation
     
     
    -Single point calculation Tutorial
    +Serial point calculation Tutorial
     =================================
     
     First open a terminal and execute Julia, then type :literal:`using MAGEMin_C` to load the package.
    @@ -12,22 +12,22 @@ Initialize database
     *******************
     .. code-block:: shell
     
    -   db          = "ig"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b)
    -   gv, z_b, DB, splx_data      = init_MAGEMin(db);
    +   # Initialize database  - new way
    +   db          =   "ig"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b); um, ultramafic (Evans & Frost 2021)
    +   data        =   Initialize_MAGEMin(db, verbose=true);
     
     This initiatizes the global variables and the Database.
     
    +|
    +
     Set P-T-(pressure temperature)
     **********************************************************
     .. code-block:: shell
     
    -   P           = 8.
    -   T           = 800.
    -   sys_in      = "mol"     # wt or mol, default is mol
    -   test        = 0;
    -   gv          = use_predefined_bulk_rock(gv, test, db)
    +   P           =   8.0
    +   T           =   800.0
     
    -:literal:`get_bulk_rock` retrieves the saved bulk-rock composition 0, which corresponds to KLB-1 peridotite. 
    +:literal:`use_predefined_bulk_rock` retrieves the saved bulk-rock composition 0 from database ig, which corresponds to KLB-1 peridotite. 
     
     |
     
    @@ -41,15 +41,36 @@ Use a pre-defined bulk-rock "test" composition
        test        = 0;
        gv          = use_predefined_bulk_rock(gv, test, db)
     
    +or a custom bulk-rock composition:
    +
    +.. code-block:: shell
    +
    +    Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"];
    +    X       = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0];
    +    sys_in  = "wt"    
    +
    +Note that the system unit :literal:`[mol,wt]` has to be provided here.
    +
    +where :literal:`Xoxides` is a :literal:`Vector(String)` containing the oxide names and :literal:`X` is a :literal:`Vector(Float)` of the :literal:`[mol,wt]` fraction of the bulk-rock composition.
    +The function converts
    +
    + :literal:`SiO2`, ..., :literal:`FeO` and :literal:`Fe2O3` in system unit :literal:`[mol,wt]`
    + 
    +to:
    + 
    + :literal:`SiO2`, ..., :literal:`FeOt` and :literal:`O` in system unit :literal:`[mol]`.
    +
    +Note that if the provided bulk-rock composition includes more oxides than supported, they will be ignored and the composition will be renormalized accordingly. Moreover, if both :literal:`Fe2O3` and :literal:`O` are provided, :literal:`O` will be recalculated as function of :literal:`Fe2O3`. Thus, if you want to prescribe a different :literal:`O` content, do not define :literal:`Fe2O3`!
    +
     |
     
    -Set the level of verbose :literal:`[-1,0,1]`
    -********************************************
    +Set the level of verbose :literal:`[false,true,1]`
    +**************************************************
     .. code-block:: shell   
     
    -   gv.verbose  = -1    # switch off any verbose
    +   gv.verbose  = false    # switch off any verbose
     
    -:literal:`-1`, none; :literal:`0`, stable phase assemblage; :literal:`1`, full verbose. By default :literal:`gv.verbose` = 0.
    +:literal:`false`, none; :literal:`true`, stable phase assemblage; :literal:`1`, full verbose. By default :literal:`gv.verbose` = true.
     
     |
     
    @@ -57,8 +78,15 @@ Call optimization routine for given P-T-X
     *****************************************
     .. code-block:: shell   
     
    -   gv.verbose  = -1    # switch off any verbose
    -   out         = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in)
    +   out     =   single_point_minimization(P, T, data, test=0);
    +
    +if a predefined test is used (see :doc:`/ckbk/predef`) or:
    +
    +.. code-block:: shell   
    +
    +   out     = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in)
    +
    +if a custom bulk-rock composition is provided.
     
     |
     
    @@ -104,48 +132,45 @@ The full description of what contains the output structure is given in the CookB
     
     |
     
    -Provide custom bulk rock composition
    -====================================
    -
    +Examples of serial point calculation
    +************************************
     
    -To define and use your own bulk rock composition we provide a routine that converts bulk-rock composition into the right MAGEMin format.
    -
    -* For the igneous database:
     
     .. code-block:: shell
     
    -   bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"]
    -   bulk_in    = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0]
    -   sys_in     = "wt"
    -   db         = "ig"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b)
    -
    -   gv         = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db);
    -
    -* For the metapelite database
    +   #load MAGEMin
    +   using MAGEMin_C 
     
    -.. code-block:: shell
    +   data    = Initialize_MAGEMin("ig", verbose=false);
     
    -   bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"]
    -   bulk_in    = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0]
    -   sys_in     = "wt"
    -   db         = "mp"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b)
    +   # One bulk rock for all points
    +   P,T     = 10.0, 1100.0
    +   Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"];
    +   X       = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0];
    +   sys_in  = "wt"    
    +   out     = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in)
    +   Finalize_MAGEMin(data)
     
    -   gv         = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db);
     
    +for the metapelite database:
     
    +.. code-block:: shell
     
    -where :literal:`bulk_in_ox` is a :literal:`Vector(String)` containing the oxide names and :literal:`bulk_in` is a :literal:`Vector(Float)` of the :literal:`[mol,wt]` fraction of the bulk-rock composition.
    -The function converts
    +   #load MAGEMin
    +   using MAGEMin_C 
     
    - :literal:`SiO2`, ..., :literal:`FeO` and :literal:`Fe2O3` in system unit :literal:`[mol,wt]`
    - 
    -to:
    - 
    - :literal:`SiO2`, ..., :literal:`FeOt` and :literal:`O` in system unit :literal:`[mol]`.
    +   #initialize
    +   data    = Initialize_MAGEMin("mp", verbose=false);
     
    -Note that if the provided bulk-rock composition includes more oxides than supported, they will be ignored and the composition will be renormalized accordingly. Moreover, if both :literal:`Fe2O3` and :literal:`O` are provided, :literal:`O` will be recalculated as function of :literal:`Fe2O3`. Thus, if you want to prescribe a different :literal:`O` content, do not define :literal:`Fe2O3`!
    +   # provide bulk-rock composition
    +   P,T      = 2.0, 650.0
    +   Xoxides  = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"]
    +   X        = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0]
    +   sys_in   = "wt"    
    +   out      = single_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in)
    +   Finalize_MAGEMin(data)
     
    -A full Julia script demonstrating how to use this function is provided below:
    +for the ultramafic database:
     
     .. code-block:: shell
     
    @@ -153,33 +178,38 @@ A full Julia script demonstrating how to use this function is provided below:
        using MAGEMin_C 
     
        #initialize
    -   db          = "ig"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b)
    -   gv, z_b, DB, splx_data      = init_MAGEMin(db);     
    +   data    = Initialize_MAGEMin("um", verbose=false);
     
        # provide bulk-rock composition
    -   bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"];
    -   bulk_in    = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0];
    -   sys_in     = "wt"
    +   P,T      = 2.0, 650.0
    +   out      = single_point_minimization(P, T, data, test=0)
    +   Finalize_MAGEMin(data)
     
    -   # convert bulk rock
    -   gv         = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db);
     
    -   # provide pressure and temperature conditions
    -   P,T        = 10.0, 1100.0;
     
    -   # switch off any verbose
    -   gv.verbose = -1    
    +Parallel point calculation Tutorial
    +===================================
     
    -   # perform minimization    
    -   out        = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in)
    +To compute a list of single point calculation in parallel your can use the native Julia multi-threading. To activate multi-threading simply launch the Julia terminal as:
     
    -   # print output
    -   print_info(out)
    +.. code-block:: shell
     
    -   # free memory
    -   finalize_MAGEMin(gv,DB)
    +   julia -t 4
     
    -of for the metapelite database:
    +or 
    +
    +.. code-block:: shell
    +
    +   julia --threads 4
    +
    +where the number of threads depends on your system, generally twice the number of cores. 
    +
    +|
    +
    +Examples of serial point calculation
    +************************************
    +
    +To run :literal:`n` points, using database :literal:`ig` and :literal:`test 0` (see :doc:`/ckbk/predef`):
     
     .. code-block:: shell
     
    @@ -187,28 +217,35 @@ of for the metapelite database:
        using MAGEMin_C 
     
        #initialize
    -   db          = "mp"  # database: ig, igneous (Holland et al., 2018); mp, metapelite (White et al 2014b)
    -   gv, z_b, DB, splx_data      = init_MAGEMin(db);     
    +   data    =   Initialize_MAGEMin("ig", verbose=false);
    +   n       =   100;
    +   P       =   fill(8.0,n)
    +   T       =   fill(800.0,n)
    +   out     =   multi_point_minimization(P, T, data, test=1);
    +   Finalize_MAGEMin(data)
     
    -   # provide bulk-rock composition
    -   bulk_in_ox = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "MnO"; "H2O"]
    -   bulk_in    = [69.64; 13.76; 1.77; 1.73; 4.32; 0.4; 2.61; 2.41; 0.80; 0.07; 10.0]
    -   sys_in     = "wt"
    +Here the results are stored in :literal:`out` as :literal:`out[1:end]`. Various bulk-rock compositions can be prescribed as:
     
    -   # convert bulk rock
    -   gv         = define_bulk_rock(gv, bulk_in, bulk_in_ox, sys_in, db);
    +.. code-block:: shell
     
    -   # provide pressure and temperature conditions
    -   P,T        = 4.0, 800.0;
    +   #load MAGEMin
    +   using MAGEMin_C 
     
    -   # switch off any verbose
    -   gv.verbose = -1    
    +   #initialize
    +   data    = Initialize_MAGEMin("ig", verbose=false);
     
    -   # perform minimization    
    -   out        = point_wise_minimization(P,T, gv, z_b, DB, splx_data, sys_in)
    +   #set P-T-X conditions
    +   P       = [10.0, 10.0];
    +   T       = [1100.0, 1100.0];
    +   Xoxides = ["SiO2"; "Al2O3"; "CaO"; "MgO"; "FeO"; "Fe2O3"; "K2O"; "Na2O"; "TiO2"; "Cr2O3"; "H2O"];
    +   X1      = [48.43; 15.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0];
    +   X2      = [49.43; 14.19; 11.57; 10.13; 6.65; 1.64; 0.59; 1.87; 0.68; 0.0; 3.0];
    +   X       = [X1,X2];
    +   sys_in  = "wt"    
    +   out     = multi_point_minimization(P, T, data, X=X, Xoxides=Xoxides, sys_in=sys_in)
     
    -   # print output
    -   print_info(out)
     
    -   # free memory
    -   finalize_MAGEMin(gv,DB)
    +Other examples
    +==============
    +
    +Several additional tests are provided in :literal:`./test/runtests.jl`.
    diff --git a/docs/ckbk.html b/docs/ckbk.html
    index c8c6e727..8fd02e8c 100644
    --- a/docs/ckbk.html
    +++ b/docs/ckbk.html
    @@ -131,6 +131,10 @@
     
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -312,6 +321,14 @@

    Pseudosection generatorSave figure (vector)

  • + +
    +

    Predefined bulk-rocks

    +
    diff --git a/docs/ckbk/Commands.html b/docs/ckbk/Commands.html index b1fc7a46..949ee567 100644 --- a/docs/ckbk/Commands.html +++ b/docs/ckbk/Commands.html @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/ckbk/gui.html b/docs/ckbk/gui.html index b7824659..495f486f 100644 --- a/docs/ckbk/gui.html +++ b/docs/ckbk/gui.html @@ -19,7 +19,7 @@ - + @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -609,7 +618,7 @@

    Save figure (vector) - +
    diff --git a/docs/ckbk/out_struct.html b/docs/ckbk/out_struct.html index 765449c3..8f2688a9 100644 --- a/docs/ckbk/out_struct.html +++ b/docs/ckbk/out_struct.html @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/ckbk/predef.html b/docs/ckbk/predef.html new file mode 100644 index 00000000..599ffb27 --- /dev/null +++ b/docs/ckbk/predef.html @@ -0,0 +1,487 @@ + + + + + + + List of pre-defined bulk-rock composition — MAGEMin 2022 documentation + + + + + + + + + + + + + + + + + +
    + + +
    + +
    +
    +
    + +
    +
    +
    +
    + +
    +

    List of pre-defined bulk-rock composition

    + + ++++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Table Title

    title

    comments

    test

    oxide

    frac

    db

    +
    FPWorldMedian pelite

    Water oversaturated

    +
    +
    +

    Forshaw, J. B., & Pattison, D. R. (2023)

    0

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O

    70.999, 12.805, 0.771, 3.978, 6.342, 2.7895, 1.481, 0.758, 0.72933, 0.075, 30.0

    mp

    +
    FPWorldMedian pelite

    Water undersaturated

    +
    +
    +

    Forshaw, J. B., & Pattison, D. R. (2023)

    1

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O

    70.999, 12.805, 0.771, 3.978, 6.342, 2.7895, 1.481, 0.758, 0.72933, 0.075, 5.0

    mp

    +
    Pelite

    Water oversaturated

    +
    +
    +

    White et al., 2014, Fig 8

    2

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O

    64.578, 13.651, 1.586, 5.529, 8.025, 2.943, 2.0, 0.907, 0.65, 0.175, 40.0

    mp

    +
    Pelite

    Water +undersaturated

    +
    +
    +

    White et al., 2014, Fig 8

    3

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O

    64.578, 13.651, 1.586, 5.529, 8.025, 2.943, 2.0, 0.907, 0.65, 0.175, 6.244

    mp

    +
    Garnet-migmatite

    AV0832a

    +
    +
    +

    Riel et al., 2013

    4

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, MnO, H2O

    73.988, 8.6143, 2.0146, 2.7401, 3.8451, 1.7686, 2.482, 0.6393, 0.11, 0.063, 10.0

    mp

    +
    SM89

    MORB composition

    +
    +
    +

    Sun & McDonough, 1989

    0

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O

    52.47, 9.1, 12.21, 12.71, 8.15, 0.23, 2.61, 1.05, 1.47, 20.0

    mb

    +
    Natural amphibolite

    LT Granulite

    +
    +
    +

    unpublished

    1

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O

    51.08, 9.68, 13.26, 11.21, 11.66, 0.16, 0.79, 1.37, 0.8, 20.0

    mb

    +
    SQA

    Synthetic amphibolite

    +
    +
    +

    Patino Douce & Beard, 1995

    2

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O

    60.05, 6.62, 8.31, 9.93, 6.57, 0.44, 1.83, 1.27, 0.33, 4.64

    mb

    BL478: Sample 478

    Beard & Lofgren, 1991

    3

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, H2O

    53.96, 9.26, 10.15, 8.11, 10.14, 0.11, 2.54, 1.35, 0.98, 3.42

    mb

    +
    KLB1 Peridotite

    Anhydrous

    +
    +
    +

    Holland et al., 2018

    0

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    38.494, 1.776, 2.824, 50.566, 5.886, 0.01, 0.25, 0.1, 0.096, 0.109, 0.0

    ig

    +
    RE46

    Icelandic basalt

    +
    +
    +

    Yang et al., 1996

    1

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    50.72, 9.16, 15.21, 16.25, 7.06, 0.01, 1.47, 0.39, 0.35, 0.01, 0.0

    ig

    N_MORB - Basalt

    Gale et al., 2013

    2

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    53.21, 9.41, 12.21, 12.21, 8.65, 0.09, 2.9, 1.21, 0.69, 0.02, 0.0

    ig

    MIX1-G - Pyroxenite

    Hirschmann et al., 2003

    3

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    45.25, 8.89, 12.22, 24.68, 6.45, 0.03, 1.39, 0.67, 0.11, 0.02, 0.0

    ig

    High-Al basalt

    Baker, 1983

    4

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    54.4, 12.96, 11.31, 7.68, 8.63, 0.54, 3.93, 0.79, 0.41, 0.01, 0.0

    ig

    Tonalite 101

    Piwinskii, 1968

    5

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    66.01, 11.98, 7.06, 4.16, 5.3, 1.57, 4.12, 0.66, 0.97, 0.01, 50.0

    ig

    Wet Basalt

    unpublished

    6

    SiO2, Al2O3, CaO, MgO, FeOt, K2O, Na2O, TiO2, O, Cr2O3, H2O

    50.081, 8.6901, 11.6698, 12.1438, 7.7832, 0.215, 2.4978, 1.0059, 0.467, 0.01, 5.4364

    ig

    Serpentine oxidized

    Evans & Forst, 2021

    0

    SiO2, Al2O3, MgO, FeOt, O, H2O, S

    20.044, 0.6256, 29.24, 3.149, 0.7324, 46.755, 0.3

    um

    Serpentine reduced

    Evans & Forst, 2021

    1

    SiO2, Al2O3, MgO, FeOt, O, H2O, S

    20.044, 0.6256, 29.24, 3.149, 0.1324, 46.755, 0.3

    um

    +
    + + +
    +
    + +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/docs/dev.html b/docs/dev.html index 33a1d0dc..5e3417cf 100644 --- a/docs/dev.html +++ b/docs/dev.html @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/dev/Dev.html b/docs/dev/Dev.html index 95f1a5a5..2afd7426 100644 --- a/docs/dev/Dev.html +++ b/docs/dev/Dev.html @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/faq.html b/docs/faq.html index c83013b5..7e566bbe 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -131,6 +131,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C diff --git a/docs/genindex.html b/docs/genindex.html index ff85cdd3..24a61b8d 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -128,6 +128,10 @@
  • Save figure (vector)
  • +
  • Predefined bulk-rocks +
  • Julia interface:

  • Use MAGEMin_C @@ -370,6 +379,8 @@

    D

  • dpdx_ig_ep (C function)
  • dpdx_ig_fl (C function) +
  • +
  • dpdx_ig_fper (C function)
  • dpdx_ig_g (C function)
  • @@ -398,11 +409,11 @@

    D

  • dpdx_mp_ep (C function)
  • dpdx_mp_g (C function) -
  • -
  • dpdx_mp_ilm (C function)
  • - +