Modelling of proton and metal exchange in the alginate biopolymer.