Calculation of solubility and precipitation