Simplified the calc_pH routine.