Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equilibrium root solver fails when some concentrations are 0 #190

Open
yakdahl opened this issue Dec 18, 2020 · 1 comment
Open

Equilibrium root solver fails when some concentrations are 0 #190

yakdahl opened this issue Dec 18, 2020 · 1 comment

Comments

@yakdahl
Copy link

yakdahl commented Dec 18, 2020

Hi! First of all, thanks so much for this package, I really appreciate it!

This is a minor issue: I'm using the Eqsys.root function to solve for equilibrium concentrations in order to analyze a titration curve measured by UV-VIS. I'm trying to estimate extinction coefficients of unknown complexes by simulating these concentrations and noticed that the solver fails when one of my concentrations is 0 i.e. the beginning point of my titration before any addition. While I can work around it, maybe it would be possible to catch this exception before passing the values to the solver and just return the input concentration? Might make more sense than returning a warning and some non-physical concentrations.

Here's an example:

Example_root_fail.txt

@bjodah
Copy link
Owner

bjodah commented Dec 18, 2020

Hi @yakdahl, thanks for letting us know. This is a nice suggestion for improvement.

When a component is completely missing (Cl in this case), we should handle that case by adding code detecting that a component is excluded and solve a smaller problem (with all reactions involving any absent substances removed). In your case, there will be no reactions left, and only the Zn(II) concentrations would be returned.

In general, we cannot guarantee that the solver will always be able to solve an arbitrary problem (due to shortcomings in the numerical solver). So at times there will probably be errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants