calculating PH