Calculation of ion concentration and Ksp