diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp index b3e7bc2236111212977c2a0cd44abddc1fd766bc..3cda89519f8f9f99a53e67db287beaaee2c926f3 100644 --- a/ChemistryLib/PhreeqcIO.cpp +++ b/ChemistryLib/PhreeqcIO.cpp @@ -462,8 +462,9 @@ std::istream& operator>>(std::istream& in, PhreeqcIO& phreeqc_io) case ItemType::pH: { // Update pH value - aqueous_solution->pH->set(chemical_system_id, - accepted_items[item_id]); + aqueous_solution->pH->set( + chemical_system_id, + std::pow(10, -accepted_items[item_id])); break; } case ItemType::pe: diff --git a/ChemistryLib/PhreeqcIOData/AqueousSolution.cpp b/ChemistryLib/PhreeqcIOData/AqueousSolution.cpp index 5d80ad5023415b69fe3935d07b58db8ad5e2f25f..8a2d213c4e2a96e833c68ebd29305a8c0856a25f 100644 --- a/ChemistryLib/PhreeqcIOData/AqueousSolution.cpp +++ b/ChemistryLib/PhreeqcIOData/AqueousSolution.cpp @@ -8,6 +8,7 @@ * */ +#include <cmath> #include <ostream> #include "AqueousSolution.h" @@ -28,17 +29,17 @@ void AqueousSolution::print(std::ostream& os, switch (charge_balance) { case ChargeBalance::pH: - os << "pH " << (*pH)[chemical_system_id] << " charge" + os << "pH " << -std::log10((*pH)[chemical_system_id]) << " charge" << "\n"; os << "pe " << (*pe)[chemical_system_id] << "\n"; break; case ChargeBalance::pe: - os << "pH " << (*pH)[chemical_system_id] << "\n"; + os << "pH " << -std::log10((*pH)[chemical_system_id]) << "\n"; os << "pe " << (*pe)[chemical_system_id] << " charge" << "\n"; break; case ChargeBalance::Unspecified: - os << "pH " << (*pH)[chemical_system_id] << "\n"; + os << "pH " << -std::log10((*pH)[chemical_system_id]) << "\n"; os << "pe " << (*pe)[chemical_system_id] << "\n"; break; }