diff --git a/ISolution.cxx b/ISolution.cxx index a9e14528..65f68667 100644 --- a/ISolution.cxx +++ b/ISolution.cxx @@ -87,7 +87,8 @@ void cxxISolution::ConvertUnits() { struct master *master_ptr = master_bsearch (iter->first); if (master_ptr != NULL && (master_ptr->minor_isotope == TRUE)) continue; - if (iter->second.get_description() == "H(1)" || iter->second.get_description() == "E") continue; + //if (iter->second.get_description() == "H(1)" || iter->second.get_description() == "E") continue; + if (strcmp(iter->second.get_description(),"H(1)") == 0 || strcmp(iter->second.get_description(), "E")) continue; if (iter->second.get_input_conc() <= 0.0) continue; /* * Convert liters to kg solution diff --git a/ISolutionComp.cxx b/ISolutionComp.cxx index 09886e09..69c45d1d 100644 --- a/ISolutionComp.cxx +++ b/ISolutionComp.cxx @@ -116,7 +116,8 @@ void cxxISolutionComp::set_gfw() input_error++; return; } - if (this->description == "Alkalinity" && this->as == "CaCO3") + //if (this->description == "Alkalinity" && this->as == "CaCO3") + if (strcmp(this->description,"Alkalinity") == 0 && strcmp(this->as, "CaCO3")) { gfw /= 2.; } diff --git a/Makefile b/Makefile index 91db42e0..1fe1b048 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,11 @@ endif all: release debug +Release: release + +Debug: debug + + RELEASE_DIR = Release DEBUG_DIR = Debug MAKEFILE = Makefile @@ -78,8 +83,10 @@ debug: # #define gmp for inverse modeling # comment the following lines to remove multiprecision option DINVERSE_CL1MP=TRUE -CL1MP_LIB=/z/parkplace/usr/lib/libgmp.a -CL1MP_OBJS=cl1mp.o +ifdef INVERSE_CL1MP + DEFINE_INVERSE_CL1MP=-DINVERSE_CL1MP + CL1MP_OBJS=cl1mp.o +endif # ----------------------------------------------------------------------------- #efence for debugging @@ -89,7 +96,7 @@ EFENCE_LIB=-L$(HOME)/packages/efence # 2 Versions # ----------------------------------------------------------------------------- ifeq ($(CFG), RELEASE) - DEFINES = -DPHREEQC_CPP -DINVERSE_CL1MP + DEFINES = -DPHREEQC_CPP $(DEFINE_INVERSE_CL1MP) VPATH = ..:../phreeqc INCLUDES = -I../phreeqc CXX = g++ @@ -99,7 +106,7 @@ ifeq ($(CFG), RELEASE) endif ifeq ($(CFG), DEBUG) - DEFINES = -DPHREEQC_CPP -DINVERSE_CL1MP -DUSE_PHRQ_ALLOC + DEFINES = -DPHREEQC_CPP -DUSE_PHRQ_ALLOC $(DEFINE_INVERSE_CL1MP) VPATH = ..:../phreeqc INCLUDES = -I../phreeqc CXX = g++ diff --git a/NameDouble.cxx b/NameDouble.cxx index b79e8dfb..d9cc422a 100644 --- a/NameDouble.cxx +++ b/NameDouble.cxx @@ -349,11 +349,14 @@ void cxxNameDouble::add_log_activities(const cxxNameDouble &addee, double f1, do } } -void cxxNameDouble::add(char * key, double total) +void cxxNameDouble::add(const char * token, double total) // // add to total for a specified element // { + char key[MAX_LENGTH]; + strcpy(key, token); + cxxNameDouble::iterator current = (*this).find(key); if (current != (*this).end()) { (*this)[key] = current->second + total; diff --git a/NameDouble.h b/NameDouble.h index e0098bfe..43130853 100644 --- a/NameDouble.h +++ b/NameDouble.h @@ -48,7 +48,7 @@ public: void add_extensive(const cxxNameDouble &old, double factor); void add_intensive(const cxxNameDouble &addee, double fthis, double f2); void add_log_activities(const cxxNameDouble &addee, double fthis, double f2); - void add(char * key, double total); + void add(const char * key, double total); void multiply(double factor); void insert(char *str, double d) { diff --git a/System.cxx b/System.cxx index f8d8bb31..efa912c4 100644 --- a/System.cxx +++ b/System.cxx @@ -39,9 +39,13 @@ void cxxSystem::totalize(void) //add solution if (this->solution != NULL) { - this->totals["O"] = this->solution->get_total_o(); - this->totals["H"] = this->solution->get_total_h(); - this->totals["Charge"] = this->solution->get_cb(); + char token[MAX_LENGTH]; + strcpy(token, "O"); + this->totals[token] = this->solution->get_total_o(); + strcpy(token, "H"); + this->totals[token] = this->solution->get_total_h(); + strcpy(token, "Charge"); + this->totals[token] = this->solution->get_cb(); this->totals.add_extensive(this->solution->get_totals(), 1.0); } if (this->exchange != NULL) diff --git a/ex1 b/ex1 deleted file mode 100644 index 8021fa1a..00000000 --- a/ex1 +++ /dev/null @@ -1,77 +0,0 @@ -PRINT - -status false -TITLE Example 1.--Add uranium and speciate seawater. -SOLUTION 1 SEAWATER FROM NORDSTROM ET AL. (1979) - units ppm - pH 8.22 - pe 8.451 - density 1.023 - temp 25.0 - redox O(0)/O(-2) - Ca 412.3 - Mg 1291.8 - Na 10768.0 - K 399.1 - Fe 0.002 - Mn 0.0002 pe - Si 4.28 - Cl 19353.0 - Alkalinity 141.682 as HCO3 - S(6) 2712.0 - N(5) 0.29 gfw 62.0 - N(-3) 0.03 as NH4 - U 3.3 ppb N(5)/N(-3) - O(0) 1.0 O2(g) -0.7 - 12C 1 .1 -SOLUTION_MASTER_SPECIES - U U+4 0.0 238.0290 238.0290 - U(4) U+4 0.0 238.0290 - U(5) UO2+ 0.0 238.0290 - U(6) UO2+2 0.0 238.0290 -SOLUTION_SPECIES - #primary master species for U - #is also secondary master species for U(4) - U+4 = U+4 - log_k 0.0 - U+4 + 4 H2O = U(OH)4 + 4 H+ - log_k -8.538 - delta_h 24.760 kcal - U+4 + 5 H2O = U(OH)5- + 5 H+ - log_k -13.147 - delta_h 27.580 kcal - #secondary master species for U(5) - U+4 + 2 H2O = UO2+ + 4 H+ + e- - log_k -6.432 - delta_h 31.130 kcal - #secondary master species for U(6) - U+4 + 2 H2O = UO2+2 + 4 H+ + 2 e- - log_k -9.217 - delta_h 34.430 kcal - UO2+2 + H2O = UO2OH+ + H+ - log_k -5.782 - delta_h 11.015 kcal - 2UO2+2 + 2H2O = (UO2)2(OH)2+2 + 2H+ - log_k -5.626 - delta_h -36.04 kcal - 3UO2+2 + 5H2O = (UO2)3(OH)5+ + 5H+ - log_k -15.641 - delta_h -44.27 kcal - UO2+2 + CO3-2 = UO2CO3 - log_k 10.064 - delta_h 0.84 kcal - UO2+2 + 2CO3-2 = UO2(CO3)2-2 - log_k 16.977 - delta_h 3.48 kcal - UO2+2 + 3CO3-2 = UO2(CO3)3-4 - log_k 21.397 - delta_h -8.78 kcal -PHASES - Uraninite - UO2 + 4 H+ = U+4 + 2 H2O - log_k -3.490 - delta_h -18.630 kcal -END -USE solution 1 -REACTION_TEMPERATURE - 30 -END \ No newline at end of file