From 02289ffb8df5ae04385d3eeaa02d169be2b1168d Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Thu, 10 Jul 2025 17:09:48 +0100 Subject: [PATCH 1/6] modification of mosek param --- .../waterGibbsEnergyOfFormation.m | 28 +++++++++++++++++++ src/base/solvers/mosek/setMosekParam.m | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/analysis/thermo/reactantContribution/waterGibbsEnergyOfFormation.m diff --git a/src/analysis/thermo/reactantContribution/waterGibbsEnergyOfFormation.m b/src/analysis/thermo/reactantContribution/waterGibbsEnergyOfFormation.m new file mode 100644 index 0000000000..2ab2a35f4b --- /dev/null +++ b/src/analysis/thermo/reactantContribution/waterGibbsEnergyOfFormation.m @@ -0,0 +1,28 @@ +function dGf0=waterGibbsEnergyOfFormation(T) +%http://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Units=SI&Mask=2#ref-2 +A =-203.6060; +B =1523.290; +C =-3196.413; +D =2474.455; +E =3.855326; +F =-256.5478; +G =-488.7163; +H =-285.8304; + +% t = temperature (K) / 1000. +t=T/1000; + +% Cp = heat capacity (J/mol*K) +%Cp = A + B*t + C*t2 + D*t3 + E/t2 + +% H° = standard enthalpy (kJ/mol) +dHf_liquid = -285.83; % (kJ/mol) +H = dHf_liquid + A*t + B*((t^2)/2) + C*(t^3)/3 + D*(t^4)/4 - E/t + F - H; + +% S° = standard entropy (J/mol*K) +S = A*log(t) + B*t + C*(t^2)/2 + D*(t^3)/3 - E/(2*t^2) + G; +% TS° = standard entropy (kJ/mol) +TS = T*1000*S; + +dGf0 = H - TS; + \ No newline at end of file diff --git a/src/base/solvers/mosek/setMosekParam.m b/src/base/solvers/mosek/setMosekParam.m index 8b786f0b11..224c5271ed 100644 --- a/src/base/solvers/mosek/setMosekParam.m +++ b/src/base/solvers/mosek/setMosekParam.m @@ -18,8 +18,10 @@ % A higher level implies that more information is logged. switch param.printLevel case 0 + param.MSK_IPAR_LOG = 0; echolev = 0; case 1 + param.MSK_IPAR_LOG = 1; echolev = 3; case 2 param.MSK_IPAR_WRITE_DATA_PARAM='MSK_ON'; From 78cad7ccec34e0d3298f2f2db6117a650f0328a9 Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Wed, 5 Nov 2025 09:26:06 +0000 Subject: [PATCH 2/6] getCorresponding updated --- papers | 2 +- src/analysis/topology/getCorrespondingCols.m | 26 ++++++++++---------- src/analysis/topology/getCorrespondingRows.m | 26 ++++++++++---------- src/base/solvers/mosek/parseMskResult.m | 8 +++--- tutorials | 2 +- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/papers b/papers index 8e5729ccbf..54e4738921 160000 --- a/papers +++ b/papers @@ -1 +1 @@ -Subproject commit 8e5729ccbfd23646ec045c3a517f6403d72c3e43 +Subproject commit 54e473892122697afdeb02109eae84659b841bb1 diff --git a/src/analysis/topology/getCorrespondingCols.m b/src/analysis/topology/getCorrespondingCols.m index f7274243e4..c97cf116cf 100644 --- a/src/analysis/topology/getCorrespondingCols.m +++ b/src/analysis/topology/getCorrespondingCols.m @@ -1,4 +1,4 @@ -function restrictedColBool = getCorrespondingCols(S, rowBool, colBool, mode) +function restrictedColBool = getCorrespondingCols(A, rowBool, colBool, mode) % Returns a boolean vector that is true for a subset of the true cols in % `colBool` according to whether the cols 'exclusive', 'inclusive', or % 'partial' -ly correspond to true entries in `rowBool` @@ -6,10 +6,10 @@ % % USAGE: % -% restrictedColBool = getCorrespondingCols(S, rowBool, colBool, mode) +% restrictedColBool = getCorrespondingCols(A, rowBool, colBool, mode) % % INPUTS: -% S: `m x n` stoichiometric matrix +% A: `m x n` matrix % rowBool: `m x 1` boolean vector % colBool: `n x 1` boolean vector % mode: 'exclusive' or 'inclusive' or 'partial' @@ -19,7 +19,7 @@ % % EXAMPLE: % -% S = +% A = % -1 0 0 0 0 % 2 -3 0 0 0 % 0 4 -5 0 0 @@ -58,34 +58,34 @@ error('colBool must be a logical vector') end -[mlt,nlt]=size(S); +[mlt,nlt]=size(A); if length(rowBool)~=mlt - error('length of rowBool must equal size(S,1)') + error('length of rowBool must equal size(A,1)') end if length(colBool)~=nlt - error('length of rowBool must equal size(S,2)') + error('length of rowBool must equal size(A,2)') end restrictedColBool=false(nlt,1); switch mode case 'exclusive' %corresponding reactions exclusively involving certain metabolites - restrictedColBool(colBool)= any(S( rowBool,colBool),1)'... - & ~any(S(~rowBool,colBool),1)'; + restrictedColBool(colBool)= any(A( rowBool,colBool),1)'... + & ~any(A(~rowBool,colBool),1)'; case 'inclusive' %corresponding reactions involving certain metabolites - restrictedColBool(colBool)=any(S( rowBool,colBool),1)'; + restrictedColBool(colBool)=any(A( rowBool,colBool),1)'; case 'partial' %metatbolites exclusively involved in certain reactions - restrictedColBool(colBool)= any(S( rowBool,colBool),1)'... - & ~any(S(~rowBool,colBool),1)'; + restrictedColBool(colBool)= any(A( rowBool,colBool),1)'... + & ~any(A(~rowBool,colBool),1)'; %corresponding reactions involving certain metabolites restricedColBool2=false(nlt,1); - restricedColBool2(colBool)=any(S( rowBool,colBool),1)'; + restricedColBool2(colBool)=any(A( rowBool,colBool),1)'; %difference restrictedColBool= restricedColBool2 & ~restrictedColBool; otherwise diff --git a/src/analysis/topology/getCorrespondingRows.m b/src/analysis/topology/getCorrespondingRows.m index 4b54f4175e..8ff14d333b 100644 --- a/src/analysis/topology/getCorrespondingRows.m +++ b/src/analysis/topology/getCorrespondingRows.m @@ -1,14 +1,14 @@ -function restricedRowBool = getCorrespondingRows(S, rowBool, colBool, mode) +function restricedRowBool = getCorrespondingRows(A, rowBool, colBool, mode) % Returns a boolean vector that is true for a subset of the true rows in % `rowBool` according to whether the rows 'exclusive', 'inclusive', or % 'partial' -ly correspond to true entries in `colBool` % % USAGE: % -% restricedRowBool = getCorrespondingRows(S, rowBool, colBool, mode) +% restricedRowBool = getCorrespondingRows(A, rowBool, colBool, mode) % % INPUTS: -% S: `m x n` stoichiometric matrix +% A: `m x n` matrix % rowBool: `m x 1` boolean vector % colBool: `n x 1` boolean vector % mode: 'exclusive' , 'inclusive' or 'partial' @@ -18,7 +18,7 @@ % % EXAMPLE: % -% S = +% A = % -1 0 0 0 0 % 2 -3 0 0 0 % 0 4 -5 0 0 @@ -62,33 +62,33 @@ error('colBool must be a logical vector') end -[mlt,nlt]=size(S); +[mlt,nlt]=size(A); if length(rowBool)~=mlt - error('length of rowBool must equal size(S,1)') + error('length of rowBool must equal size(A,1)') end if length(colBool)~=nlt - error('length of rowBool must equal size(S,2)') + error('length of rowBool must equal size(A,2)') end restricedRowBool=false(mlt,1); switch mode case 'exclusive' %metatbolites exclusively involved in certain reactions - restricedRowBool(rowBool)= any(S(rowBool, colBool),2)... - & ~any(S(rowBool,~colBool),2); + restricedRowBool(rowBool)= any(A(rowBool, colBool),2)... + & ~any(A(rowBool,~colBool),2); case 'inclusive' %corresponding reactions involving certain metabolites - restricedRowBool(rowBool) = any(S(rowBool, colBool),2); + restricedRowBool(rowBool) = any(A(rowBool, colBool),2); case 'partial' %metatbolites exclusively involved in certain reactions - restricedRowBool(rowBool)= any(S(rowBool, colBool),2)... - & ~any(S(rowBool,~colBool),2); + restricedRowBool(rowBool)= any(A(rowBool, colBool),2)... + & ~any(A(rowBool,~colBool),2); %corresponding reactions involving certain metabolites restricedRowBool2=false(mlt,1); - restricedRowBool2(rowBool) = any(S(rowBool, colBool),2); + restricedRowBool2(rowBool) = any(A(rowBool, colBool),2); %difference restricedRowBool= restricedRowBool2 & ~restricedRowBool; otherwise diff --git a/src/base/solvers/mosek/parseMskResult.m b/src/base/solvers/mosek/parseMskResult.m index c83290466d..79ab054ab7 100644 --- a/src/base/solvers/mosek/parseMskResult.m +++ b/src/base/solvers/mosek/parseMskResult.m @@ -212,8 +212,8 @@ accessSolution = 'dontAccess'; end otherwise - accessSolution = 'dontAccess'; origStat = -1; + accessSolution = 'dontAccess'; end if strcmp(accessSolution,'dontAccess') @@ -224,7 +224,7 @@ case {'DUAL_INFEASIBLE_CER','MSK_SOL_STA_DUAL_INFEAS_CER','MSK_SOL_STA_NEAR_DUAL_INFEAS_CER'} stat=2; % Unbounded solution origStat = [origStat ' & ' res.rcodestr]; - case {'UNKNOWN','PRIM_ILLPOSED_CER','PRIMAL_ILLPOSED_CER','DUAL_ILLPOSED_CER','PRIM_FEAS','DUAL_FEAS','PRIM_AND_DUAL_FEAS','DUAL_FEASIBLE'} + case {'UNKNOWN','PRIM_ILLPOSED_CER','PRIMAL_ILLPOSED_CER','DUAL_ILLPOSED_CER','PRIM_FEAS','DUAL_FEAS','PRIM_AND_DUAL_FEAS','DUAL_FEASIBLE','MSK_RES_ERR_IN_ARGUMENT'} stat=-1; %some other problem origStat = [origStat ' & ' res.rcodestr]; otherwise @@ -233,8 +233,8 @@ fprintf('%s\n',res.rcode) fprintf('%s\n',res.rmsg) fprintf('%s\n',res.rcodestr) - if strcmp(origStat,'UNKNOWN') - origStat = [origStat ' & ' res.rcodestr]; + if isfield(res,'rcodestr') && ~isempty(res.rcodestr) + origStat = res.rcodestr; end end end diff --git a/tutorials b/tutorials index 68aec12607..0b3fdd6880 160000 --- a/tutorials +++ b/tutorials @@ -1 +1 @@ -Subproject commit 68aec126073cabcc621c78300e40cd609b0568d5 +Subproject commit 0b3fdd68808c803cd861a49cd3a2630d77e9d686 From 29ad8b393a91c31830c01ed9f3397081275975dd Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Wed, 5 Nov 2025 09:42:15 +0000 Subject: [PATCH 3/6] gitmoduels updated to follow master --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 31f8babc6f..a35c1faa20 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,7 +52,7 @@ path = papers url = https://github.com/opencobra/COBRA.papers.git ignore = dirty - branch = master + branch = master [submodule "octave-networks-toolbox"] path = external/analysis/octave-networks-toolbox url = https://github.com/aeolianine/octave-networks-toolbox.git @@ -77,9 +77,9 @@ path = external/base/io/xlread url = https://github.com/tpfau/xlread ignore = dirty - branch = master + branch = master [submodule "external/visualization/MatGPT"] path = external/visualization/MatGPT url = https://github.com/toshiakit/MatGPT.git ignore = dirty - branch = main + branch = master From c8483f3fef7f2fd4902019fafac556a7fee15344 Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Wed, 5 Nov 2025 09:43:53 +0000 Subject: [PATCH 4/6] gitmoduels updated to follow master or main for matgpt --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index a35c1faa20..f9f256446d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -82,4 +82,4 @@ path = external/visualization/MatGPT url = https://github.com/toshiakit/MatGPT.git ignore = dirty - branch = master + branch = main From e66468921025a35fed6300c4dfed34e182c8d9e8 Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Wed, 5 Nov 2025 10:01:48 +0000 Subject: [PATCH 5/6] papers submodule: track master; sync to origin/master --- .gitmodules | 4 ++-- papers | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 31f8babc6f..11c65b0cb4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,7 +52,7 @@ path = papers url = https://github.com/opencobra/COBRA.papers.git ignore = dirty - branch = master + branch = master [submodule "octave-networks-toolbox"] path = external/analysis/octave-networks-toolbox url = https://github.com/aeolianine/octave-networks-toolbox.git @@ -82,4 +82,4 @@ path = external/visualization/MatGPT url = https://github.com/toshiakit/MatGPT.git ignore = dirty - branch = main + branch = main diff --git a/papers b/papers index 9ad115e78c..54e4738921 160000 --- a/papers +++ b/papers @@ -1 +1 @@ -Subproject commit 9ad115e78c56e01d89e6dd75f8f0746ee1513f9a +Subproject commit 54e473892122697afdeb02109eae84659b841bb1 From ce81ec0fef02635297fafd75df66ccceeef7d644 Mon Sep 17 00:00:00 2001 From: Ronan Fleming Date: Wed, 5 Nov 2025 10:05:42 +0000 Subject: [PATCH 6/6] this command should work: git submodule foreach git pull --- tutorials | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials b/tutorials index 94d5b877ca..0b3fdd6880 160000 --- a/tutorials +++ b/tutorials @@ -1 +1 @@ -Subproject commit 94d5b877ca1ec602107666d194340a49c20ba21d +Subproject commit 0b3fdd68808c803cd861a49cd3a2630d77e9d686