-
Notifications
You must be signed in to change notification settings - Fork 80
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
Give two dict() in chemstry.Reaction() not work #218
Comments
Interesting, I think SymPy's Integer class might have changed: >>> type(react['H2'])
sympy.core.numbers.Integer or it has always been broken, I'm not sure. Either way there's plenty of things to improve on here (PRs most welcome). But the short term work around is to perform no checks when creating >>> print(chempy.chemistry.Reaction(dict(react), dict(prod), checks=()))
2 H2 + O2 -> 2 H2O or selective disable the "all_integral" check: >>> print(chempy.chemistry.Reaction(dict(react), dict(prod), dont_check={"all_integral"}))
2 H2 + O2 -> 2 H2O |
Thank you so much, I'm gonna work on a pull to help you soon as can. I meantime this seem work fine. |
No stress! I reported the change in behavior in sympy/sympy#24268 too. |
Could we just change if v != type(v)(int(v)): to if v != int(v) and v != type(v)(int(v)): It does work. |
Sounds promising! would you mind opening a pull request? |
Documentation is clear on format Reaction(react,prod). React and prod are two dicts but is you try to give a dictionary object (like a variable) you'll see an error lambda for checking type.
Example
We try to take stoichiometry:
This will give:
This error will not occur if you pass result (we use dict() because belance create a OrderDict) dict in clear:
Is there a way for bypass? (store dict(react) or dict(prod) in another variable will give (of course) same error.
The text was updated successfully, but these errors were encountered: