pHcalc
pHcalc copied to clipboard
Added titration method to solve for concentrations of a system of chemical species which produce a target pH
This PR adds the following features:
- conc_solve method takes a target pH value, and will search for concentrations of constituent species in a system which will attain the desired pH value. This implementation is much faster computationally speaking than running minimize on a function which in turn calls the .pHsolve method with its own minimization function.
- cond_solve method approximates the conductivity of a system given some cubic regressions modelling how those species contribute to the conductivity of a solution. This may be slightly outside of the scope of what the pHcalc library really seeks to do, but for our application bundling this feature in with the pH calcs presents a lot of improvements.
- conc_solve_cond takes a target conductivity value, and suggests molar concentrations of constituent species which will achieve that target conductivity (in mS / cm)
- conc_solve_complete takes both target conductivity and pH, and will solve for a system of chemical species yielding those pH and conductivity values.
I tried to follow the style of the existing library, but may have deviated in some places. Please let me know if there are any stylistic notes that I should change. If the additional functionality relating to conductivity is not of interest to you, the pH buffer solution component is stable in the third commit of my branch, and everything relating to conductivity was added in the fourth commit.