I'm using a program for calculating chemical reactions, but I'm not a chemist. I will use the results for a different type of calculation. Sorry, this is probably a silly question. As input for the program, I am using a chemical system that someone published. it contains: SO4(2-), Ca2+, Na+, K+, Mg2+, Cl-, HCO3-. It has a specified pH. Each ion has a concentration value. The problem is that when I put all this into the program, I get an error saying that I have a charge imbalance. I'm very confused because this is a chemical system that has apparently been used many times before. I'm not sure if this is important, but the method my program is based on is Gibbs free energy minimization. The method that was previously used on this system was the Law of Mass Action. My program can add or subtract charge to make things balance, but this seems dangerous to me. Wouldn't this change the kinds of reactions that can happen? Also, when I do this, I get a crazy pH that is very different that the one published. Does anyone have any insight into dealing with this? Or understanding it? Thank you very much.