Comments (3)
from chempy.
So it looks like this is a bug in how the coefficients by which the equations should be multiplied are calculated. The code was using the result of sympy.primefactors()
and division to get the coefficients instead of counting the factors from sympy.factorint()
. The old code worked for non-repeating, relatively prime factors but was failing on others and the only test was on the former. I've managed to patch that and rework the elimination tests and add your examples. I've pushed the changes here. If you can test it, let me know how it works.
The sign of the coefficients still needs some work I believe. Everything works, signs included, except the manganese-bromate redox reaction. Right now the elimination coefficients are both negative and it seems like they should be positive but I need to chase more of the stoichiometry logic in other functions to be certain. I would also like to add some documentation on the signs of these coefficients (at least in the code; it may be elsewhere) and some more tests cases.
from chempy.
I've pushed the latest fixes to the above branch. The permanganate-bromate reaction elimination coefficients should both be positive but were both returning negative. The important thing was that both coefficients have the same sign; the negative would only reverse the reaction. This was happening arbitrarily based on whether the first reaction was eliminating a reactant and the second a product, or vice-versa. I've added a check for all negative coefficients, and that seems to solve all the current tests.
At this point, we should probably add more tests to increase confidence in the solution and get some more eyes on the changes. Currently, the elimination method will only handle two reactions and not any number of reactions in general. So it works fine for redox half reactions but would need to be generalized further before using for something like elimination in a sequence of Hess's Law reaction steps. There's a commented example of a failing test that demonstrates the problem.
from chempy.
Related Issues (20)
- Equilibrium root solver fails when some concentrations are 0 HOT 1
- pycvodes/pykinsol failing to compile with python 3.9.1 HOT 4
- Check if reaction is stoichiometry balanced HOT 1
- Equilibrium root fails with water & co2-hydrolysis test
- Interest in chemical group theory component? HOT 3
- 7 tests fail on FreeBSD HOT 2
- Could this package be used to solve steam reforming problems?
- Interpreting malformed chemical formulas as substances HOT 32
- Suggestion: Funding coding or documentation through Google Summer of Code or Season of Docs HOT 1
- Please fill out SymPy documentation theme survey
- Test ChemPy with SymPy 1.10rc2 HOT 1
- Update README for improved chemical formula parser HOT 8
- New release? HOT 1
- FYI: ChemPy mentioned in Talk Python to Me podcast HOT 1
- Balancing reactions with non-integer stoichiometry HOT 1
- Two pytests are failing in our GitHub Action HOT 3
- Chempy documentation issues HOT 4
- Installation Errors HOT 2
- Give two dict() in chemstry.Reaction() not work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chempy.