Skip to content
Snippets Groups Projects
Commit f8b4047d authored by renchao.lu's avatar renchao.lu
Browse files

[CL] Unit conversion for pH.

parent afab4147
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment