MrHomeScientist
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 1806
Registered: 24-10-2010
Location: Flerovium
Member Is Offline
Mood: No Mood
|
|
The Stoichiometer
I like to think one of my specialties is writing small software tools to help in various tasks. At my day job, this is mostly for data analysis. For
quite a while now I've wanted to write a tool to help with stoichiometry, and I've finally gotten around to doing it. I call it the Stoichiometer.
To use: simply enter in a chemical equation in the box, and click Calculate. (Make sure it's a balanced equation! The program won't do it for
you.) The molecular weights of each piece will be displayed. Choose a molecule and type in your desired mass in grams in the box below it and press
Enter, and the rest of the boxes will be filled with the stoichiometrically-calculated values!
I wrote this mainly for myself, so there are a few conventions that must be followed for it to work that you might not necessarily use. I left in a
sample equation as an example of the required format.
Quote: | 1) The program does not accept decimal coefficients. So no H<sub>2</sub> + 0.5O<sub>2</sub>
= H<sub>2</sub>O ! I've never liked decimal coefficients, so I don't use them, and didn't want to take the effort to code it in. Just
multiply your equations! ![:D](./images/smilies/biggrin.gif)
2) Equations must be entered in the format A + B = C + D. Plus signs, a single equals sign, and spaces. Spaces aren't critical (if you omit them, the
display gets weird but the calculations still work), but the format of the + and = does matter.
3) Capitalization matters. Otherwise your nitric oxide (NO) might be interpreted as nobelium (No). Write your formulas properly!
|
The program is to the point where I believe it works, and has passed several test cases. Now I'd like to recruit you all as beta testers Try it out, and let me know if any particular equation breaks the program or gives a
wrong answer. If it works for you, great! Feel free to use it as much as you like.
I'll also include the source code if anyone wants to modify it. And so you can see there aren't any viruses built in! I'm sure there are more elegant
ways to write the program, but these sort of tools are usually meant for just myself and the point is to write them quickly so that they save more
time than they take. Hope it's useful to people!
Improvements that could be made:
- Add an equation balancing module!
- Convert it to a web-based app so you can more easily access it from your phone!
Attachment: Stoichiometer.exe (16kB) This file has been downloaded 1178 times
Attachment: Stoichiometer.zip (61kB) This file has been downloaded 631 times
[Edited on 12-25-2017 by MrHomeScientist]
|
|
j_sum1
Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 6256
Registered: 4-10-2014
Location: Unmoved
Member Is Offline
Mood: Organised
|
|
Sounds good. I'll take a look when I am on the laptop.
|
|
j_sum1
Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 6256
Registered: 4-10-2014
Location: Unmoved
Member Is Offline
Mood: Organised
|
|
I like it.
You are right -- it would be good to have an equation balancer as well but that is a whole other task.
What would be really cool is a phone version. I would find that really practical.
Some suggestions.
1. I know why you did it but in practice it would be better without the sample equation in the input box. I don't realy want to delete it every
time.
2. It would be cool if it remembered the last few compounds that were used. No need for a complex library or anything but a drop down list of the
most recent 20 would be great. After all, when you are doing this stuff you are usually on a cycle of related compounds until the next project. I'd
rather not type in ferric ammonium sulfate 18 hydrate more often than I need to.
|
|
ninhydric1
Hazard to Others
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 345
Registered: 21-4-2017
Location: Western US
Member Is Offline
Mood: Bleached
|
|
I can finally spend more time in the lab instead of doing these goddamn tedious calculations! Very nice MrHomeScientist; the interface looks great and
it works smoothly.
The philosophy of one century is the common sense of the next.
|
|
MrHomeScientist
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 1806
Registered: 24-10-2010
Location: Flerovium
Member Is Offline
Mood: No Mood
|
|
Ask and ye shall receive!
Version 1.1
- Replaced main text box with combobox, to remember previously entered equations
- Initial sample equation disappears when box is clicked the first time
- Added ability to press Enter in the combobox instead of clicking the run button
- Added save functionality to remember equations entered in previous sessions
- Equations are saved to Stoichiometer.dat, in the same directory as the executable
- Added Delete button to remove equations from the list and save file
Attachment: Stoichiometer.exe (18kB) This file has been downloaded 1007 times
Attachment: Stoichiometer.zip (66kB) This file has been downloaded 651 times
If this takes off and becomes popular, I'd love to add an equation balancer. Would be an interesting challenge to write one.
A phone app would be perfect, if I knew how to code phone apps! Would be something cool to learn for sure. Thanks for the feedback!
|
|
j_sum1
Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 6256
Registered: 4-10-2014
Location: Unmoved
Member Is Offline
Mood: Organised
|
|
Wow! that was fast.
Do I need everything in the zip file -- I just ran the exe and it seems ok by itself.
One further thing... and maybe this is my machine. The window does not resize well. When the equation runs too wide for the window a horizontal
scroll bar appears. That's fine but when I widen the window, the window gets bigger but the content dows not change -- the scroll vbar remains and
the amount of visible equation is unchanged.
Edit
If it helps there are numerous equation balancers around online which you might hack or fish for ideas. I confess that I don't use them much but I
reckon I would use it a lot if incorporated into the stoichiometer.
Anyway, this is the one I have bookmarked -- seems above average.
https://www.webqc.org/balance.php
[Edited on 3-1-2018 by j_sum1]
|
|
MrHomeScientist
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 1806
Registered: 24-10-2010
Location: Flerovium
Member Is Offline
Mood: No Mood
|
|
No, the zip file is just the source code in case people want to edit it themselves. If you just want to run the program, all you need is the exe.
Protip: If it's easier for you, you can skip the GUI and edit the Stoichiometer.dat file directly to enter in your equations. Just open it with
notepad and put each equation on its own separate line. The program imports that file every time it starts up. You can also delete equations directly
from there, or delete the file entirely if you want to wipe the slate clean. The program will re-create it if it doesn't exist.
Resizing isn't something I really considered when writing it; I'll look into it. Should be a simple change.
Edit: Well damn, the site you linked already does everything my program does and more. Here I thought I was being innovative.
[Edited on 1-3-2018 by MrHomeScientist]
|
|
j_sum1
Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 6256
Registered: 4-10-2014
Location: Unmoved
Member Is Offline
Mood: Organised
|
|
Well, TBH, I had forgotten that that particular site did the stoichiometry bit. I haven't looked at it for over a year. I found it while looking for
teaching resources but it was not a whole lot of help. I want my students to be able to balance equations and do stoichiometry calculations for
themselves. Once they know the theory and can do it for themselves, that is when they can take some calculation short-cuts.
I still like what you have done. And I am not always online (despite what my post-frequency suggests.)
|
|
fusso
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 1922
Registered: 23-6-2017
Location: 4 ∥ universes ahead of you
Member Is Offline
|
|
I tried your program and I found out some improvements you can make:
1. make the UI resizable. When I drag the corners to resize the window only the window resized, not the content. So If you have a long eqn and a lot
of reactants and products then I still have to drag that horizontal bar at the bottom to see the far end.
2. increase the decimal places just like the site jsum recommended since some may want more dp for their work.
|
|
woelen
Super Administrator
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 7990
Registered: 20-8-2005
Location: Netherlands
Member Is Offline
Mood: interested
|
|
I have an online equation balancer on my website. It also is capable of detecting reactions in which multiple possibilities exist (an example is the
following: Cu + HNO3 --> NO + NO2 + Cu(NO3)2 + H2O).
The page also allows you to introduce groups which are preserved (e.g. a group CH3 can be added and named Me and then this Me pseudo element can be
used in equations).
Finally, the program can do weight calculations. Just in one of the numeric fields type =, followed by a number, and click the recalculate button.
http://woelen.homescience.net:18080/chemeq/
Click the Help button for a detailed tutorial, it explains all you need.
|
|
Sulaiman
International Hazard
![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif) ![*](images/xpblue/star.gif)
Posts: 3631
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline
|
|
My main problems with stoichiometry are not really stoichiometry problems as such, or even balancing equations,
it is working out what the products will be,
for example, I often see Na2CO3 instead of NaHCO3, Na2O etc. as products produced in aqueous solution.
So I would like a programme / an app that I enter the starting reactants into
and it magically outputs a balanced equation
with the stoichiometrically done for me.
With options and warnings for concentration, pH level, or other relevant conditions etc.
i.e. I want an interactive compendium of all known chemical reactions, that's all ![:P](./images/smilies/tongue.gif)
EDIT : Pretty please ![:D](./images/smilies/biggrin.gif)
[Edited on 8-5-2018 by Sulaiman]
CAUTION : Hobby Chemist, not Professional or even Amateur
|
|
MJ101
Hazard to Self
![*](images/xpblue/star.gif)
Posts: 82
Registered: 14-6-2018
Member Is Offline
Mood: Always Sunny
|
|
Hi MrHomeScientist,
On Form1, set the Anchor property of panel1 to Top,Left,Right.
This will make the panel resize with the width of the form. ![:)](./images/smilies/smile.gif)
Best,
|
|