From 1daa513a58cf3313f523ef9fb940eee1a3adf1e9 Mon Sep 17 00:00:00 2001 From: "mirondanro@yahoo.com" Date: Mon, 27 Jul 2026 18:01:07 +0200 Subject: [PATCH 1/3] Update .gitignore and refactor TPitzer memory management --- .gitignore | 2 + GEMS3K/s_solmod.h | 4 - GEMS3K/s_solmod5.cpp | 176 ++++++------------------------------------- 3 files changed, 24 insertions(+), 158 deletions(-) diff --git a/.gitignore b/.gitignore index 27054253..cbe2a94b 100644 --- a/.gitignore +++ b/.gitignore @@ -74,4 +74,6 @@ nodearray-gem/nodearray-gem3.pro.user lib-gems3k/.qmake.stash lib-gems3k/release/libgems3k3.a .qmake.stash +CLAUDE.md +environment.yml diff --git a/GEMS3K/s_solmod.h b/GEMS3K/s_solmod.h index 05202293..6d00b3e3 100644 --- a/GEMS3K/s_solmod.h +++ b/GEMS3K/s_solmod.h @@ -1504,10 +1504,6 @@ class TPitzer: public TSolMod void Ecalc( double z, double z1, double I, double DH_term, double& Etheta, double& Ethetap ); - void ETHETAS(double ZJ, double ZK, double I, double DH_term, double& etheta, double& ethetap); - - void ETHETA_PARAMS(double X, double& JAY, double& JPRIME ); - inline long int getN() const { return Nc+Na+Nn; diff --git a/GEMS3K/s_solmod5.cpp b/GEMS3K/s_solmod5.cpp index 0d52269d..408b7c4b 100644 --- a/GEMS3K/s_solmod5.cpp +++ b/GEMS3K/s_solmod5.cpp @@ -693,37 +693,32 @@ void TPitzer::free_internal() - if(Nn != 0) + for(i=0; i= 0; i-- ) - { - BK[i] = L_Z * BK[i + 1] - BK[i + 2] + AK[i]; - DK[i] = BK[i + 1] + L_Z * DK[i + 1] - DK[i + 2]; - } - - JAY = X / 4.0e0 - 1.0e0 + 0.5e0 * (BK[0] - BK[2]); - JPRIME = X * .25e0 + L_DZ * (DK[0] - DK[2]); -} - - /// Calculate Z-Term, Pitzer-Toughreact Report 2006, equation (A8) double TPitzer::Z_Term() { @@ -1770,7 +1644,6 @@ double TPitzer::lnGammaH2O( double DH_term ) z=zc[c]; z1=zc[c1]; Ecalc( z, z1, I, Aphi, Etheta,Ethetap); - //ETHETAS( z, z1, I, Aphi, Etheta,Ethetap); // needs testing Theta[c1][c]=Theta[c][c1]; Phiphi = Theta[c][c1] + Etheta + Ethetap * I;// * sqrt(I); Pitzer-Toughreact Report 2006, equation (A14) OC3 += (pmc[c]*pmc[c1]*(Phiphi + OC3a)); @@ -1791,7 +1664,6 @@ double TPitzer::lnGammaH2O( double DH_term ) z=za[a]; z1=za[a1]; Ecalc(z,z1,I,Aphi, Etheta,Ethetap); - //ETHETAS( z, z1, I, Aphi, Etheta,Ethetap); // needs testing Theta1[a1][a]=Theta1[a][a1]; Phiphi1 = Theta1[a][a1] + Etheta + Ethetap * I; // Pitzer-Toughreact Report, 2006 equation (A14) OC4 += (pma[a]*pma[a1]*(Phiphi1 + OC4a)); @@ -1885,7 +1757,7 @@ void TPitzer::getAlp( long int c, long int a, double& alp, double& alp1 ) { alp=2.0; alp1=50.; - } + } } @@ -1934,7 +1806,6 @@ double TPitzer::F_Factor( double DH_term ) z=zc[c]; z1=zc[c1]; Ecalc(z,z1,I,DH_term, Etheta,Ethetap); - //ETHETAS( z, z1, I, DH_term, Etheta,Ethetap); // needs testing Phip = Ethetap; //Pitzer-Toughreact Report 2006, equation (A16) F2 +=(pmc[c]*pmc[c1]*(Phip)); } @@ -1950,7 +1821,6 @@ double TPitzer::F_Factor( double DH_term ) z=za[a]; z1=za[a1]; Ecalc(z,z1,I,DH_term, Etheta,Ethetap); - //ETHETAS( z, z1, I, DH_term, Etheta,Ethetap); // needs testing Phip1=Ethetap; //Pitzer-Toughreact Report 2006, equation (A16) F3 +=(pma[a]*pma[a1]*(Phip1)); } @@ -2000,7 +1870,7 @@ double TPitzer::lnGammaM( long int M, double DH_term ) getAlp( M, a, alp, alp1 ); if (!essentiallyEqual(Alp1[M][a],0.0)) alp=Alp1[M][a]; - if (!essentiallyEqual(Alp1[M][a],0.0)) + if (!essentiallyEqual(Alp2[M][a],0.0)) alp1=Alp2[M][a]; C = Cphi[M][a]/(2.*sqrt(fabs(za[a]*zc[M]))); // Pitzer-Toughreact Report 2006, equation (A7) x_alp = alp*Is; @@ -2023,7 +1893,6 @@ double TPitzer::lnGammaM( long int M, double DH_term ) } z = zc[M]; z1 = zc[c1]; - //ETHETAS( z, z1, I, DH_term, Etheta,Ethetap); // needs testing Ecalc(z,z1,I,DH_term ,Etheta,Ethetap); Theta[c1][M] = Theta[M][c1]; Phi = Theta[M][c1]+Etheta; // Pitzer-Toughreact Report 2006, equation (A15) @@ -2113,7 +1982,7 @@ double TPitzer::lnGammaX( long int X, double DH_term ) getAlp( c, X, alp, alp1 ); if (!essentiallyEqual(Alp1[c][X],0.0)) alp=Alp1[c][X]; - if (!essentiallyEqual(Alp1[c][X],0.0)) + if (!essentiallyEqual(Alp2[c][X],0.0)) alp1=Alp2[c][X]; C = Cphi[c][X]/(2.*sqrt(fabs(za[X]*zc[c]))); x_alp = alp*Is; @@ -2136,7 +2005,6 @@ double TPitzer::lnGammaX( long int X, double DH_term ) z = za[X]; z1 = za[a1]; Ecalc(z,z1,I,DH_term , Etheta,Ethetap); - //ETHETAS( z, z1, I, DH_term, Etheta,Ethetap); // needs testing Theta1[a1][X] = Theta1[X][a1]; Phi1 = Theta1[X][a1]+Etheta; From c88d0cdc1159f2e22971bd56f3fbfd72ae1ea651 Mon Sep 17 00:00:00 2001 From: George Dan Miron <44091914+gdmiron@users.noreply.github.com> Date: Tue, 4 Aug 2026 10:06:31 +0200 Subject: [PATCH 2/3] Update project version to 4.6.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b5051ea..3639bc71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16..4.2) # Set the name of the project -project(GEMS3K VERSION 4.5.5 LANGUAGES CXX C) +project(GEMS3K VERSION 4.6.0 LANGUAGES CXX C) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) From 737aa0fd98a5c29f8aa41baf65e06d7d713e0255 Mon Sep 17 00:00:00 2001 From: "mirondanro@yahoo.com" Date: Mon, 10 Aug 2026 18:16:12 +0200 Subject: [PATCH 3/3] Fix error messages in TPitzer::PTcalc for clarity on index requirements --- GEMS3K/s_solmod5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GEMS3K/s_solmod5.cpp b/GEMS3K/s_solmod5.cpp index 408b7c4b..64748c25 100644 --- a/GEMS3K/s_solmod5.cpp +++ b/GEMS3K/s_solmod5.cpp @@ -1345,7 +1345,7 @@ void TPitzer::PTcalc( int Gex_or_Sex ) else in = getIn( aIPx[ii * MaxOrd + 2] ); } - ErrorIf( ic<0||in<0||i<0, "PTcalc", "Index of anion and 2 indexes of cations needed here" ); + ErrorIf( ic<0||in<0||i<0, "PTcalc", "Index of neutral and 2 indexes of cations needed here" ); Eta[ic][i][in] = setvalue(ii, Gex_or_Sex); Eta[i][ic][in] = Eta[ic][i][in]; // ca-ca-n @@ -1370,7 +1370,7 @@ void TPitzer::PTcalc( int Gex_or_Sex ) else in = getIn( aIPx[ii * MaxOrd + 2] ); } - ErrorIf( in<0||ia<0||i<0, "PTcalc", "Indexes of 2 anions and one cation needed here" ); + ErrorIf( in<0||ia<0||i<0, "PTcalc", "Indexes of 2 anions and one neutral needed here" ); Eta1[ia][i][in] = setvalue(ii, Gex_or_Sex); Eta1[i][ia][in] = Eta1[ia][i][in]; // an-an-n