From f03c453eb429bd37151b6cdfed5c401fed459df0 Mon Sep 17 00:00:00 2001 From: Scott R Charlton Date: Thu, 20 Feb 2014 07:19:05 +0000 Subject: [PATCH] passes all unit tests on windows git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8506 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- src/IPhreeqc.cpp | 148 ++++++++---------- src/IPhreeqc.hpp | 6 +- unit/TestIPhreeqc.cpp | 7 + unit/TestIPhreeqc.h | 2 + unit/kinn20140218 | 349 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 428 insertions(+), 84 deletions(-) create mode 100644 unit/kinn20140218 diff --git a/src/IPhreeqc.cpp b/src/IPhreeqc.cpp index 96d1611c..a2b04faf 100644 --- a/src/IPhreeqc.cpp +++ b/src/IPhreeqc.cpp @@ -44,7 +44,6 @@ IPhreeqc::IPhreeqc(void) , WarningStringOn(true) , WarningReporter(0) , CurrentSelectedOutputUserNumber(1) -, SelectedOutputStringOn(false) , PhreeqcPtr(0) , input_file(0) , database_file(0) @@ -64,6 +63,9 @@ IPhreeqc::IPhreeqc(void) std::pair::iterator, bool> pr = IPhreeqc::Instances.insert(instance); mutex_unlock(&map_lock); + this->SelectedOutputStringOn[1] = false; + + this->SelectedOutputFileOnMap[1] = false; this->SelectedOutputFileNameMap[1] = this->sel_file_name(1); ::sprintf(buffer, OUTPUT_FILENAME_FORMAT, this->Index); @@ -95,7 +97,6 @@ IPhreeqc::~IPhreeqc(void) delete (*sit).second; } this->SelectedOutputMap.clear(); - this->CurrentSelectedOutputMap.clear(); mutex_lock(&map_lock); std::map::iterator it = IPhreeqc::Instances.find(this->Index); @@ -369,7 +370,7 @@ int IPhreeqc::GetSelectedOutputColumnCount(void)const int IPhreeqc::GetSelectedOutputCount(void)const { - ASSERT(this->PhreeqcPtr->SelectedOutput_map.size() == this->CurrentSelectedOutputMap.size()); + ASSERT(this->PhreeqcPtr->SelectedOutput_map.size() == this->SelectedOutputMap.size()); return (int) this->PhreeqcPtr->SelectedOutput_map.size(); } @@ -402,7 +403,8 @@ int IPhreeqc::GetSelectedOutputRowCount(void)const const char* IPhreeqc::GetSelectedOutputString(void)const { static const char err_msg[] = "GetSelectedOutputString: SelectedOutputStringOn not set.\n"; - if (!this->SelectedOutputStringOn) + std::map< int, bool >::const_iterator ci = this->SelectedOutputStringOn.find(this->CurrentSelectedOutputUserNumber); + if (ci == this->SelectedOutputStringOn.end()) { return err_msg; } @@ -438,7 +440,7 @@ int IPhreeqc::GetSelectedOutputStringLineCount(void)const bool IPhreeqc::GetSelectedOutputStringOn(void)const { - return this->SelectedOutputStringOn; + return this->get_sel_out_string_on(this->CurrentSelectedOutputUserNumber); } VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR) @@ -578,13 +580,6 @@ int IPhreeqc::load_db(const char* filename) // cleanup // this->UnLoadDatabase(); - std::map< int, CSelectedOutput* >::iterator it = this->SelectedOutputMap.begin(); - for (; it != this->SelectedOutputMap.end(); ++it) - { - delete (*it).second; - } - this->SelectedOutputMap.clear(); - this->CurrentSelectedOutputMap.clear(); // open file // @@ -656,13 +651,6 @@ int IPhreeqc::load_db_str(const char* input) // cleanup // this->UnLoadDatabase(); - std::map< int, CSelectedOutput* >::iterator it = this->SelectedOutputMap.begin(); - for (; it != this->SelectedOutputMap.end(); ++it) - { - delete (*it).second; - } - this->SelectedOutputMap.clear(); - this->CurrentSelectedOutputMap.clear(); std::string s(input); std::istringstream iss(s); @@ -983,7 +971,7 @@ void IPhreeqc::SetSelectedOutputFileOn(bool bValue) void IPhreeqc::SetSelectedOutputStringOn(bool bValue) { - this->SelectedOutputStringOn = bValue; + this->SelectedOutputStringOn[this->CurrentSelectedOutputUserNumber] = bValue; } int IPhreeqc::test_db(void) @@ -1023,6 +1011,8 @@ void IPhreeqc::UnLoadDatabase(void) this->CurrentSelectedOutputUserNumber = 1; this->SelectedOutputFileOnMap.clear(); this->SelectedOutputFileOnMap[1] = false; + this->SelectedOutputStringOn.clear(); + this->SelectedOutputStringOn[1] = false; std::map< int, CSelectedOutput* >::iterator itt = this->SelectedOutputMap.begin(); for (; itt != this->SelectedOutputMap.end(); ++itt) @@ -1030,7 +1020,6 @@ void IPhreeqc::UnLoadDatabase(void) delete (*itt).second; } this->SelectedOutputMap.clear(); - this->CurrentSelectedOutputMap.clear(); std::map< int, std::string >::iterator mit = this->SelectedOutputStringMap.begin(); for (; mit != this->SelectedOutputStringMap.begin(); ++mit) @@ -1062,10 +1051,10 @@ int IPhreeqc::EndRow(void) { if (this->PhreeqcPtr->current_selected_output) { - std::map< SelectedOutput*, CSelectedOutput* >::iterator it = - this->CurrentSelectedOutputMap.find(this->PhreeqcPtr->current_selected_output); + std::map< int, CSelectedOutput* >::iterator it = + this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()); - if (it != this->CurrentSelectedOutputMap.end()) + if (it != this->SelectedOutputMap.end()) { // ensure all user_punch headings are included ASSERT(this->PhreeqcPtr->n_user_punch_index >= 0); @@ -1092,7 +1081,7 @@ void IPhreeqc::check_database(const char* sz_routine) delete (*it).second; } this->SelectedOutputMap.clear(); - this->CurrentSelectedOutputMap.clear(); + this->SelectedOutputStringMap.clear(); // release this->LogString.clear(); @@ -1169,46 +1158,24 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL std::map< int, SelectedOutput >::iterator mit = this->PhreeqcPtr->SelectedOutput_map.begin(); for (; mit != this->PhreeqcPtr->SelectedOutput_map.end(); ++mit) { - if (mit->second.Get_new_def()) - { - int n = mit->first; - std::map< SelectedOutput*, CSelectedOutput* >::iterator it = this->CurrentSelectedOutputMap.begin(); - for ( ; it != this->CurrentSelectedOutputMap.end(); it++) - { - if (it->first->Get_n_user() == n) - { - delete it->second; - this->CurrentSelectedOutputMap.erase(it); - break; - } - } - } - if (this->CurrentSelectedOutputMap.find(&(*mit).second) == this->CurrentSelectedOutputMap.end()) + if (this->SelectedOutputMap.find(mit->first) == this->SelectedOutputMap.end()) { // int -> CSelectedOutput* std::map< int, CSelectedOutput* >::value_type item((*mit).first, new CSelectedOutput()); this->SelectedOutputMap.insert(item); - // SelectedOutput* -> CSelectedOutput* - this->CurrentSelectedOutputMap.insert( - std::map< SelectedOutput*, CSelectedOutput* >::value_type( - &(*mit).second, item.second)); - - // SelectedOutput* -> std::string* - this->CurrentToStringMap.insert( - std::map< SelectedOutput*, std::string* >::value_type( - &(*mit).second, &this->SelectedOutputStringMap[(*mit).first])); + // int -> std::string + this->SelectedOutputStringMap.insert( + std::map< int, std::string >::value_type((*mit).first, std::string())); } else { - ASSERT(this->SelectedOutputMap.find((*mit).first) != this->SelectedOutputMap.end()); - ASSERT(this->CurrentSelectedOutputMap.find(&(*mit).second) != this->CurrentSelectedOutputMap.end()); - ASSERT(this->CurrentToStringMap.find(&(*mit).second) != this->CurrentToStringMap.end()); - - ASSERT(this->SelectedOutputMap[(*mit).first] == this->CurrentSelectedOutputMap[&(*mit).second]); + ASSERT(this->SelectedOutputMap.find((*mit).first) != this->SelectedOutputMap.end()); + ASSERT(this->SelectedOutputStringMap.find((*mit).first) != this->SelectedOutputStringMap.end()); } } - ASSERT(this->PhreeqcPtr->SelectedOutput_map.size() == this->CurrentSelectedOutputMap.size()); + ASSERT(this->PhreeqcPtr->SelectedOutput_map.size() == this->SelectedOutputMap.size()); + ASSERT(this->PhreeqcPtr->SelectedOutput_map.size() == this->SelectedOutputStringMap.size()); if (this->PhreeqcPtr->title_x != NULL) { ::sprintf(token, "TITLE"); @@ -1477,17 +1444,22 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL } } - if (this->SelectedOutputStringOn) + for (int i = 0; i < this->GetSelectedOutputCount(); ++i) { - std::map< int, std::string >::iterator mit = this->SelectedOutputStringMap.begin(); - for (; mit != this->SelectedOutputStringMap.end(); ++mit) + int n = this->GetNthSelectedOutputUserNumber(i); + if (this->get_sel_out_string_on(n)) { - // output lines - std::istringstream iss((*mit).second); - std::string line; - while (std::getline(iss, line)) + std::map< int, std::string >::iterator mit = this->SelectedOutputStringMap.find(n); + ASSERT(mit != this->SelectedOutputStringMap.end()); + if (mit != this->SelectedOutputStringMap.end()) { - this->SelectedOutputLinesMap[(*mit).first].push_back(line); + // output lines + std::istringstream iss((*mit).second); + std::string line; + while (std::getline(iss, line)) + { + this->SelectedOutputLinesMap[(*mit).first].push_back(line); + } } } } @@ -1596,10 +1568,13 @@ void IPhreeqc::screen_msg(const char *err_str) void IPhreeqc::punch_msg(const char *str) { - if (this->SelectedOutputStringOn && this->punch_on) + if (this->get_sel_out_string_on(this->PhreeqcPtr->current_selected_output->Get_n_user()) && this->punch_on) { - ASSERT(this->CurrentToStringMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentToStringMap.end()); - *(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output]) += str; + ASSERT(this->PhreeqcPtr->current_selected_output); + if (this->PhreeqcPtr->current_selected_output) + { + this->SelectedOutputStringMap[this->PhreeqcPtr->current_selected_output->Get_n_user()] += str; + } } ASSERT(!(this->SelectedOutputFileOnMap[this->PhreeqcPtr->current_selected_output->Get_n_user()] != (this->PhreeqcPtr->current_selected_output->Get_punch_ostream() != 0))); this->PHRQ_io::punch_msg(str); @@ -1696,13 +1671,13 @@ void IPhreeqc::fpunchf(const char *name, const char *format, double d) try { this->PHRQ_io::fpunchf(name, format, d); - if (this->SelectedOutputStringOn && this->punch_on) + if (this->get_sel_out_string_on(this->PhreeqcPtr->current_selected_output->Get_n_user()) && this->punch_on) { - ASSERT(this->CurrentToStringMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentToStringMap.end()); - PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, d); + ASSERT(this->SelectedOutputStringMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputStringMap.end()); + PHRQ_io::fpunchf_helper(&(this->SelectedOutputStringMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]), format, d); } - ASSERT(this->CurrentSelectedOutputMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentSelectedOutputMap.end()); - this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackDouble(name, d); + ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end()); + this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackDouble(name, d); } catch (std::bad_alloc) { @@ -1715,13 +1690,13 @@ void IPhreeqc::fpunchf(const char *name, const char *format, char *s) try { this->PHRQ_io::fpunchf(name, format, s); - if (this->SelectedOutputStringOn && this->punch_on) + if (this->get_sel_out_string_on(this->PhreeqcPtr->current_selected_output->Get_n_user()) && this->punch_on) { - ASSERT(this->CurrentToStringMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentToStringMap.end()); - PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, s); + ASSERT(this->SelectedOutputStringMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputStringMap.end()); + PHRQ_io::fpunchf_helper(&(this->SelectedOutputStringMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]), format, s); } - ASSERT(this->CurrentSelectedOutputMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentSelectedOutputMap.end()); - this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackString(name, s); + ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end()); + this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackString(name, s); } catch (std::bad_alloc) { @@ -1734,13 +1709,13 @@ void IPhreeqc::fpunchf(const char *name, const char *format, int i) try { this->PHRQ_io::fpunchf(name, format, i); - if (this->SelectedOutputStringOn && this->punch_on) + if (this->get_sel_out_string_on(this->PhreeqcPtr->current_selected_output->Get_n_user()) && this->punch_on) { - ASSERT(this->CurrentToStringMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentToStringMap.end()); - PHRQ_io::fpunchf_helper(this->CurrentToStringMap[this->PhreeqcPtr->current_selected_output], format, i); + ASSERT(this->SelectedOutputStringMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputStringMap.end()); + PHRQ_io::fpunchf_helper(&(this->SelectedOutputStringMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]), format, i); } - ASSERT(this->CurrentSelectedOutputMap.find(this->PhreeqcPtr->current_selected_output) != this->CurrentSelectedOutputMap.end()); - this->CurrentSelectedOutputMap[this->PhreeqcPtr->current_selected_output]->PushBackLong(name, (long)i); + ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end()); + this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackLong(name, (long)i); } catch (std::bad_alloc) { @@ -1764,6 +1739,17 @@ bool IPhreeqc::get_sel_out_file_on(int n)const return false; } +bool IPhreeqc::get_sel_out_string_on(int n)const +{ + // if not found in list SelectedOutputStringOn is false + std::map< int, bool >::const_iterator ci = this->SelectedOutputStringOn.find(this->CurrentSelectedOutputUserNumber); + if (ci != this->SelectedOutputStringOn.end()) + { + return (*ci).second; + } + return false; +} + bool IPhreeqc::punch_open(const char *file_name, std::ios_base::openmode mode, int n_user) { if (this->PhreeqcPtr->SelectedOutput_map[n_user].Get_have_punch_name() && diff --git a/src/IPhreeqc.hpp b/src/IPhreeqc.hpp index 6d081c1e..364ea8ac 100644 --- a/src/IPhreeqc.hpp +++ b/src/IPhreeqc.hpp @@ -889,6 +889,8 @@ protected: bool get_sel_out_file_on(int n)const; std::string sel_file_name(int n_user); + bool get_sel_out_string_on(int n)const; + protected: #if defined(_MSC_VER) /* disable warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' */ @@ -928,8 +930,6 @@ protected: int CurrentSelectedOutputUserNumber; std::map< int, CSelectedOutput* > SelectedOutputMap; - std::map< SelectedOutput*, CSelectedOutput* > CurrentSelectedOutputMap; - std::map< SelectedOutput*, std::string* > CurrentToStringMap; std::string StringInput; std::string DumpString; @@ -944,7 +944,7 @@ protected: std::string LogFileName; std::string DumpFileName; - bool SelectedOutputStringOn; + std::map< int, bool > SelectedOutputStringOn; std::map< int, std::string > SelectedOutputStringMap; std::map< int, std::vector< std::string > > SelectedOutputLinesMap; diff --git a/unit/TestIPhreeqc.cpp b/unit/TestIPhreeqc.cpp index ef20f494..25c9c29e 100644 --- a/unit/TestIPhreeqc.cpp +++ b/unit/TestIPhreeqc.cpp @@ -4158,3 +4158,10 @@ void TestIPhreeqc::TestWissmeier20131203_3(void) CPPUNIT_ASSERT_EQUAL( 1, obj.GetSelectedOutputColumnCount() ); CPPUNIT_ASSERT_EQUAL( 2, obj.GetSelectedOutputRowCount() ); } + +void TestIPhreeqc::TestKinniburgh20140218(void) +{ + IPhreeqc obj; + CPPUNIT_ASSERT_EQUAL(0, obj.LoadDatabase("../database/wateq4f.dat")); + CPPUNIT_ASSERT_EQUAL(0, obj.RunFile("kinn20140218")); +} diff --git a/unit/TestIPhreeqc.h b/unit/TestIPhreeqc.h index bef7fb04..e64bd0bd 100644 --- a/unit/TestIPhreeqc.h +++ b/unit/TestIPhreeqc.h @@ -77,6 +77,7 @@ class TestIPhreeqc : public CppUnit::TestFixture CPPUNIT_TEST( TestWissmeier20131203 ); CPPUNIT_TEST( TestWissmeier20131203_2 ); CPPUNIT_TEST( TestWissmeier20131203_3 ); + CPPUNIT_TEST( TestKinniburgh20140218 ); CPPUNIT_TEST_SUITE_END(); public: @@ -154,6 +155,7 @@ public: void TestWissmeier20131203(void); void TestWissmeier20131203_2(void); void TestWissmeier20131203_3(void); + void TestKinniburgh20140218(void); protected: void TestFileOnOff(const char* FILENAME, bool output_file_on, bool error_file_on, bool log_file_on, bool selected_output_file_on, bool dump_file_on); diff --git a/unit/kinn20140218 b/unit/kinn20140218 new file mode 100644 index 00000000..5ea284a5 --- /dev/null +++ b/unit/kinn20140218 @@ -0,0 +1,349 @@ +# +#*** PhreePlot 1 (Win32) *** 20:14:59 13 Feb 2014 +# Incorporating the PHREEQC library by DL Parkhurst, SR Charlton (USGS), +# & CAJ Appelo (Amsterdam) +# Hunt & Track by DG Kinniburgh, and DM Cooper, CEH (NERC) +# Fitting by MJD Powell (University of Cambridge) +# Postscript plotting by KE Kohler +# +#Input filename: C:\PhreePlot\unittests\custom\contouring\As3_logNaVspH.ppi. +# +#Calculating... 1 + +PRINT + -selected_output false + PHASES + Fix_H+ + H+ = H+ + log_k 0 +SOLUTION_MASTER_SPECIES + [N5] [N5]O3- 0 14 14 + Perchlorate Perchlorate- 0 35 35 +SOLUTION_SPECIES + [N5]O3- = [N5]O3- + log_k 0 + Perchlorate- = Perchlorate- + log_k 0 +SURFACE_MASTER_SPECIES + Goe_uni Goe_uniOH1.5 + Goe_tri Goe_triOH0.5 +SURFACE_SPECIES + Goe_triOH0.5 = Goe_triOH0.5 + -cd_music 0 0 0 0 0 + log_k 0 + Goe_triOH0.5 = Goe_triO-0.5 + 0.5H+ + -cd_music -0.5 0 0 0 0 + log_k 10 + Goe_triO-0.5 + H+ = Goe_triOH+0.5 + -cd_music 1 0 0 0 0 + log_k 9.20 + Goe_triO-0.5 + Li+ = Goe_triOLi+0.5 + -cd_music 0 1 0 0 0 + log_k 0.10 + Goe_triO-0.5 + Na+ = Goe_triONa+0.5 + -cd_music 0 1 0 0 0 + log_k -0.60 + Goe_triO-0.5 + K+ = Goe_triOK+0.5 + -cd_music 0 1 0 0 0 + log_k -1.61 + Goe_triO-0.5 + H+ + NO3- = Goe_triOHNO3-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.52 + Goe_triO-0.5 + H+ + [N5]O3- = Goe_triOH[N5]O3-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.52 + Goe_triO-0.5 + H+ + Cl- = Goe_triOHCl-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.75 + Goe_uniOH1.5 = Goe_uniOH1.5 + -cd_music 0 0 0 0 0 + log_k 0 + Goe_uniOH1.5 = Goe_uniOH-0.5 + 0.5H+ + -cd_music -0.5 0 0 0 0 + log_k 10 + Goe_uniOH-0.5 + H+ = Goe_uniOH2+0.5 + -cd_music 1 0 0 0 0 + log_k 9.20 + Goe_uniOH-0.5 + Li+ = Goe_uniOHLi+0.5 + -cd_music 0 1 0 0 0 + log_k 0.10 + Goe_uniOH-0.5 + Na+ = Goe_uniOHNa+0.5 + -cd_music 0 1 0 0 0 + log_k -0.60 + Goe_uniOH-0.5 + K+ = Goe_uniOHK+0.5 + -cd_music 0 1 0 0 0 + log_k -1.61 + Goe_uniOH-0.5 + H+ + NO3- = Goe_uniOH2NO3-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.52 + Goe_uniOH-0.5 + H+ + [N5]O3- = Goe_uniOH2[N5]O3-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.52 + Goe_uniOH-0.5 + H+ + Cl- = Goe_uniOH2Cl-0.5 + -cd_music 1 -1 0 0 0 + log_k 8.75 + Goe_uniOH-0.5 + Ca+2 = Goe_uniOHCa+1.5 + log_k 2.85 + -cd_music 0.0 2.0 0 0 0 + Goe_triO-0.5 + Ca+2 = Goe_triOCa+1.5 + log_k 2.85 + -cd_music 0.0 2.0 0 0 0 + Goe_uniOH-0.5 + Ca+2 = Goe_uniOHCa+1.5 + log_k 3.69 + -cd_music 0.32 1.68 0 0 0 + Goe_uniOH-0.5 + Ca+2 + H2O = Goe_uniOHCaOH+0.5 + H+ + log_k -9.17 + -cd_music 0.32 0.68 0 0 0 + 2Goe_uniOH-0.5 + Mg+2 = (Goe_uniOH)2Mg+1 + log_k 4.89 + -cd_music 0.71 1.29 0 0 0 + 2Goe_uniOH-0.5 + Mg+2 + H2O = (Goe_uniOH)2MgOH + H+ + log_k -6.44 + -cd_music 0.71 0.29 0 0 0 + 2Goe_uniOH-0.5 + Cu+2 = (Goe_uniOH)2Cu+1 + log_k 9.18 + -cd_music 0.84 1.16 0 0 0 + 2Goe_uniOH-0.5 + Cu+2 + H2O = (Goe_uniOH)2CuOH + H+ + log_k 3.60 + -cd_music 0.84 0.16 0 0 0 + 2Goe_uniOH-0.5 + 2Cu+2 + 2H2O = (Goe_uniOH)2Cu2(OH)2+1 + 2H+ + log_k 3.65 + -cd_music 0.84 1.16 0 0 0 + 2Goe_uniOH-0.5 + 2Cu+2 + 3H2O = (Goe_uniOH)2Cu2(OH)3 + 3H+ + log_k -3.10 + -cd_music 0.84 0.16 0 0 0 + Goe_uniOH-0.5 + 2H+ + AsO4-3 = Goe_uniOAsO2OH-1.5 + H2O + log_k 26.60 + -cd_music 0.30 -1.30 0 0 0 + 2Goe_uniOH-0.5 + 2H+ + AsO4-3 = (Goe_uniO)2AsO2-2 + 2H2O + log_k 29.77 + -cd_music 0.47 -1.47 0 0 0 + 2Goe_uniOH-0.5 + 3H+ + AsO4-3 = (Goe_uniO)2AsOOH- + 2H2O + log_k 33.00 + -cd_music 0.58 -0.58 0 0 0 + Goe_uniOH-0.5 + H3AsO3 = Goe_uniOAs(OH)2-0.5 + H2O + log_k 4.91 + -cd_music 0.16 -0.16 0 0 0 + 2Goe_uniOH-0.5 + H3AsO3 = (Goe_uniO)2AsOH-1 + 2H2O + log_k 7.26 + -cd_music 0.34 -0.34 0 0 0 + Goe_uniOH-0.5 + 2H+ + PO4-3 = Goe_uniOPO2OH-1.5 + H2O + log_k 27.65 + -cd_music 0.28 -1.28 0 0 0 + 2Goe_uniOH-0.5 + 2H+ + PO4-3 = (Goe_uniO)2PO2-2 + 2H2O + log_k 29.77 + -cd_music 0.46 -1.46 0 0 0 + 2Goe_uniOH-0.5 + 2H+ + CO3-2 = (Goe_uniO)2CO- + 2H2O + log_k 22.33 + -cd_music 0.68 -0.68 0 0 0 + Goe_uniOH-0.5 + H+ + SO4-2 = Goe_uniOSO3-1.5 + H2O + log_k 9.37 + -cd_music 0.5 -1.5 0 0 0 + Goe_uniOH-0.5 + H+ + SO4-2 = Goe_uniOSO3-1.5 + H2O + log_k 11.06 + -cd_music 1 -1.84 -0.16 0 0 + 2Goe_uniOH-0.5 + H4SiO4 = (Goe_uniO)2Si(OH)2-1 + 2H2O + log_k 5.85 + -cd_music 0.29 -0.29 0 0 0 + 2Goe_uniOH-0.5 + 4H4SiO4 = (Goe_uniO)2SiOHOSi3O2(OH)7-1 + 5H2O + log_k 13.98 + -cd_music 0.29 -0.29 0 0 0 + 2Goe_uniOH-0.5 + 4H4SiO4 = (Goe_uniO)2SiOHOSi3O3(OH)6-2 + 5H2O + H+ + log_k 7.47 + -cd_music 0.29 -1.29 0 0 0 +SURFACE_MASTER_SPECIES + Fhy_unie Fhy_unieOH1.5 + Fhy_unic Fhy_unicOH1.5 + Fhy_tri Fhy_triOH0.5 +SURFACE_SPECIES + Fhy_triOH0.5 = Fhy_triOH0.5 + -cd_music 0 0 0 0 0 + log_k 0 + Fhy_triOH0.5 = Fhy_triO-0.5 + 0.5H+ + -cd_music -0.5 0 0 0 0 + log_k 10 + Fhy_triO-0.5 + H+ = Fhy_triOH+0.5 + -cd_music 1 0 0 0 0 + log_k 8.06 + Fhy_triO-0.5 + Na+ = Fhy_triONa+0.5 + -cd_music 0 1 0 0 0 + log_k -0.60 + Fhy_triO-0.5 + H+ + NO3- = Fhy_triOHNO3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_triO-0.5 + H+ + [N5]O3- = Fhy_triOH[N5]O3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_triO-0.5 + H+ + Cl- = Fhy_triOHCl-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.61 + Fhy_triO-0.5 + H+ + Perchlorate- = Fhy_triOHPerchlorate-0.5 + -cd_music 1 -1 0 0 0 + log_k 6.36 + Fhy_unieOH1.5 = Fhy_unieOH1.5 + -cd_music 0 0 0 0 0 + log_k 0 + Fhy_unieOH1.5 = Fhy_unieOH-0.5 + 0.5H+ + -cd_music -0.5 0 0 0 0 + log_k 10 + Fhy_unieOH-0.5 + H+ = Fhy_unieOH2+0.5 + -cd_music 1 0 0 0 0 + log_k 8.06 + Fhy_unieOH-0.5 + Na+ = Fhy_unieOHNa+0.5 + -cd_music 0 1 0 0 0 + log_k -0.60 + Fhy_unieOH-0.5 + H+ + NO3- = Fhy_unieOH2NO3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_unieOH-0.5 + H+ + [N5]O3- = Fhy_unieOH2[N5]O3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_unieOH-0.5 + H+ + Cl- = Fhy_unieOH2Cl-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.61 + Fhy_unieOH-0.5 + H+ + Perchlorate- = Fhy_unieOH2Perchlorate-0.5 + -cd_music 1 -1 0 0 0 + log_k 6.36 + Fhy_unicOH1.5 = Fhy_unicOH1.5 + -cd_music 0 0 0 0 0 + log_k 0 + Fhy_unicOH1.5 = Fhy_unicOH-0.5 + 0.5H+ + -cd_music -0.5 0 0 0 0 + log_k 10 + Fhy_unicOH-0.5 + H+ = Fhy_unicOH2+0.5 + -cd_music 1 0 0 0 0 + log_k 8.06 + Fhy_unicOH-0.5 + Na+ = Fhy_unicOHNa+0.5 + -cd_music 0 1 0 0 0 + log_k -0.60 + Fhy_unicOH-0.5 + H+ + NO3- = Fhy_unicOH2NO3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_unicOH-0.5 + H+ + [N5]O3- = Fhy_unicOH2[N5]O3-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.38 + Fhy_unicOH-0.5 + H+ + Cl- = Fhy_unicOH2Cl-0.5 + -cd_music 1 -1 0 0 0 + log_k 7.61 + Fhy_unicOH-0.5 + H+ + Perchlorate- = Fhy_unicOH2Perchlorate-0.5 + -cd_music 1 -1 0 0 0 + log_k 6.36 + 2Fhy_unicOH-0.5 + 2H+ + CO3-2 = Fhy_unic2O2CO- + 2H2O + -cd_music 0.62 -0.62 0 0 0 + log_k 21.50 + 2Fhy_unieOH-0.5 + UO2+2 = Fhy_unie2(OH)2UO2+ + -cd_music 0.9 1.1 0 0 0 + log_k 9.0 + 2Fhy_unieOH-0.5 + UO2+2 + H2O = Fhy_unie2(OH)2UO2OH + H+ + -cd_music 0.9 0.1 0 0 0 + log_k 3.30 + 2Fhy_unieOH-0.5 + UO2+2 + 2H2O = Fhy_unie2(OH)2UO2(OH)2- + 2H+ + -cd_music 0.9 -0.9 0 0 0 + log_k -5.3 + 2Fhy_unieOH-0.5 + UO2+2 + CO3-2 + H2O = Fhy_unie2(OH)2UO2CO3(OH)-2 + H+ + -cd_music 0.9 -1.9 0 0 0 + log_k 10.49 + Fhy_unicOH-0.5 + UO2+2 + 3CO3-2 + H+ = Fhy_unic(OCO2)UO2(CO3)2-3.5 + H2O + -cd_music 0.33 -3.33 0 0 0 + log_k 36.63 + Fhy_unieOH-0.5 + UO2+2 + 3CO3-2 + H+ = Fhy_unie(OCO2)UO2(CO3)2-3.5 + H2O + -cd_music 0.33 -3.33 0 0 0 + log_k 36.63 + 2Fhy_unieOH-0.5 + 3UO2+2 + 6H2O = Fhy_unie2(OH)2(UO2)3(OH)6- + 6H+ + -cd_music 0.9 -0.9 0 0 0 + log_k -15.8 + 2Fhy_unieOH-0.5 + 3UO2+2 + CO3-2 + 3H2O = Fhy_unie2(OH)2(UO2)3(OH)3CO3 + 3H+ + -cd_music 0.9 0.1 0 0 0 + log_k 14.6 +END + + SOLUTION 1 + Temp 20 + pH 3.8 + units mol/kgw + Na 0.001 + Cl 0.001 + EQUILIBRIUM_PHASES 1 + Fix_H+ -4 NaOH + -force_equality true + O2(g) -70 + SURFACE 1 + Goe_uniOH1.5 3.5 98 0.1 + Goe_triOH0.5 2.7 + -cd_music + -sites_units density + -cap 0.85 0.75 + SAVE surface 2 +END +use surface 2 +SOLUTION 1 + Temp 20 + pH 3.8 + units mol/kgw + Na 0.001 + Cl 0.001 +REACTION +Na2HAsO4 1 +0.0001 in 1 step +PRINT + -selected_output true +SELECTED_OUTPUT + -reset false + -high_precision false +USER_PUNCH + -headings logNa pH I dissAs + 10 IF (TOT("As") > 0) THEN dissas = TOT("As") ELSE dissas = -99999 + 20 totna = TOT("Na") + 30 IF (totna > 0) THEN logna = LOG10(totna) ELSE logna = -99999 + 40 PUNCH logna, -la("H+"), mu, dissas + 50 PRINT "NaT = ", totna + EQUILIBRIUM_PHASES 1 + Fix_H+ -4 NaOH + -force_equality true + O2(g) -70 +END + SOLUTION 1 + Temp 20 + pH 3.8 + units mol/kgw + Na 0.00215443469 + Cl 0.00215443469 + EQUILIBRIUM_PHASES 1 + Fix_H+ -4 NaOH + -force_equality true + O2(g) -70 + SURFACE 1 + Goe_uniOH1.5 3.5 98 0.1 + Goe_triOH0.5 2.7 + -cd_music + -sites_units density + -cap 0.85 0.75 + SAVE surface 2 +END +use surface 2 +SOLUTION 1 + Temp 20 + pH 3.8 + units mol/kgw + Na 0.00215443469 + Cl 0.00215443469 +REACTION +Na2HAsO4 1 +0.0001 in 1 step +PRINT + -selected_output true +SELECTED_OUTPUT + -reset false + -high_precision false +USER_PUNCH + -headings logNa pH I dissAs + 10 IF (TOT("As") > 0) THEN dissas = TOT("As") ELSE dissas = -99999 + 20 totna = TOT("Na") + 30 IF (totna > 0) THEN logna = LOG10(totna) ELSE logna = -99999 + 40 PUNCH logna, -la("H+"), mu, dissas + 50 PRINT "NaT = ", totna + EQUILIBRIUM_PHASES 1 + Fix_H+ -4 NaOH + -force_equality true + O2(g) -70 +END \ No newline at end of file