chemistry_paradise 1.1.26
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of chemistry_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +419 -0
- data/bin/chemistry_paradise +7 -0
- data/chemistry_paradise.gemspec +46 -0
- data/doc/BUGS.md +16 -0
- data/doc/README.gen +391 -0
- data/doc/todo/TODO.md +26 -0
- data/lib/chemistry_paradise/base/base.rb +101 -0
- data/lib/chemistry_paradise/base/colours.rb +65 -0
- data/lib/chemistry_paradise/commandline/help.rb +40 -0
- data/lib/chemistry_paradise/commandline/menu.rb +88 -0
- data/lib/chemistry_paradise/commandline/parse_commandline.rb +94 -0
- data/lib/chemistry_paradise/constants/constants.rb +52 -0
- data/lib/chemistry_paradise/constants/file_constants.rb +33 -0
- data/lib/chemistry_paradise/constants/german_names_of_elements_to_element_symbol.rb +157 -0
- data/lib/chemistry_paradise/converters/celsius_to_fahrenheit.rb +143 -0
- data/lib/chemistry_paradise/converters/fahrenheit_to_celsius.rb +132 -0
- data/lib/chemistry_paradise/converters/shared.rb +15 -0
- data/lib/chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb +34 -0
- data/lib/chemistry_paradise/gui/gtk3/show_periodic_table/show_periodic_table.rb +34 -0
- data/lib/chemistry_paradise/gui/gtk3/temperature_converter/temperature_converter.rb +249 -0
- data/lib/chemistry_paradise/gui/shared_code/calculate_molecular_weight/calculate_molecular_weight_module.rb +171 -0
- data/lib/chemistry_paradise/gui/shared_code/show_periodic_table/show_periodic_table_module.rb +318 -0
- data/lib/chemistry_paradise/images/show_periodic_table.png +0 -0
- data/lib/chemistry_paradise/interactive_chemistry_shell.rb +246 -0
- data/lib/chemistry_paradise/project/project.rb +24 -0
- data/lib/chemistry_paradise/requires/common_external_requires.rb +17 -0
- data/lib/chemistry_paradise/requires/require_the_project.rb +19 -0
- data/lib/chemistry_paradise/shared.rb +130 -0
- data/lib/chemistry_paradise/show_electron_configuration.rb +250 -0
- data/lib/chemistry_paradise/show_element.rb +145 -0
- data/lib/chemistry_paradise/sinatra/sinatra.rb +131 -0
- data/lib/chemistry_paradise/split_molecule_names.rb +228 -0
- data/lib/chemistry_paradise/toplevel_methods/atomgewichte.rb +31 -0
- data/lib/chemistry_paradise/toplevel_methods/convert_parens.rb +64 -0
- data/lib/chemistry_paradise/toplevel_methods/display_where_the_molmasses_are_kept.rb +24 -0
- data/lib/chemistry_paradise/toplevel_methods/e.rb +16 -0
- data/lib/chemistry_paradise/toplevel_methods/kelvin.rb +34 -0
- data/lib/chemistry_paradise/toplevel_methods/language.rb +50 -0
- data/lib/chemistry_paradise/toplevel_methods/misc.rb +128 -0
- data/lib/chemistry_paradise/toplevel_methods/periodic_table.rb +16 -0
- data/lib/chemistry_paradise/toplevel_methods/remove_this_molecule_from.rb +63 -0
- data/lib/chemistry_paradise/toplevel_methods/show_electron_negativity_chart.rb +26 -0
- data/lib/chemistry_paradise/utility_scripts/calculate_atomic_mass.rb +559 -0
- data/lib/chemistry_paradise/utility_scripts/combustion_analysis.rb +207 -0
- data/lib/chemistry_paradise/utility_scripts/electron_negativity_chart.rb +78 -0
- data/lib/chemistry_paradise/utility_scripts/equalize_chemical_formula.rb +84 -0
- data/lib/chemistry_paradise/utility_scripts/equation_solver.rb +130 -0
- data/lib/chemistry_paradise/utility_scripts/orbitals.rb +70 -0
- data/lib/chemistry_paradise/utility_scripts/show_electron_negativity_of_this_element.rb +103 -0
- data/lib/chemistry_paradise/verbose_chemical_calculation.rb +21 -0
- data/lib/chemistry_paradise/version/version.rb +19 -0
- data/lib/chemistry_paradise/www/chemistry/chemistry.cgi +7 -0
- data/lib/chemistry_paradise/www/chemistry/chemistry.rb +1526 -0
- data/lib/chemistry_paradise/www/chemistry/chemistry.sinatra +56 -0
- data/lib/chemistry_paradise/www/organic_chemistry/organic_chemistry.md +16 -0
- data/lib/chemistry_paradise/yaml/atomgewichte.yml +113 -0
- data/lib/chemistry_paradise/yaml/colours_for_the_elements.yml +13 -0
- data/lib/chemistry_paradise/yaml/dichte.yml +21 -0
- data/lib/chemistry_paradise/yaml/electron_negativity_chart.yml +111 -0
- data/lib/chemistry_paradise/yaml/molecular_formula_of_different_molecules.yml +13 -0
- data/lib/chemistry_paradise/yaml/periodic_table_of_the_elements.yml +125 -0
- data/lib/chemistry_paradise.rb +1 -0
- data/test/testing_chemistry_paradise.rb +49 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: db3c9068fb8cdebf3d6ec69a84df47fb429b819a903495af1fa879af8a7ea131
|
4
|
+
data.tar.gz: 9087744870680126607ab2b2a34bf84326de3d4e0a12fa1df4f40b9304ff39b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 631e75ce09a69bb618ab0d637b00a8830b1c3d3a4b81d67af2c9e087dd45d112d8d6cb3d499bae4db4ae79aec88226da1690825182a50887365bf771d3c884de
|
7
|
+
data.tar.gz: 3a7b46a229c1694f3be8fa0e71869c9fd8d23c2c771503cfd044d5aceed52d2fa452c0d167de3e4756b84c8800859286d88f04c9aa5176dffb2d2115369b0288
|
data/README.md
ADDED
@@ -0,0 +1,419 @@
|
|
1
|
+
[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
|
2
|
+
[![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/chemistry_paradise.svg)](https://badge.fury.io/rb/chemistry_paradise)
|
4
|
+
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">11.04.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">00:41:29</span> o'clock.
|
6
|
+
|
7
|
+
## Introduction
|
8
|
+
|
9
|
+
This project bundles together some commonly used methods and classes
|
10
|
+
related to **chemistry**.
|
11
|
+
|
12
|
+
Use cases may include when you want to quickly know the molecular
|
13
|
+
weight of a compound (via the commandline) or when you want to
|
14
|
+
want to perform a simple **combustion analysis**, so mostly
|
15
|
+
homework, school, college or simple university-related use cases.
|
16
|
+
|
17
|
+
Please keep in mind that this is just a hobby project. It will
|
18
|
+
never compete with professional or commercial-grade projects,
|
19
|
+
simply because that is not its main use case or goal. It's also
|
20
|
+
not my primary project related to science - I am more of a molecular
|
21
|
+
biology person, so the code in this project is mostly just
|
22
|
+
"helper"-related code. Perhaps you may find some interesting
|
23
|
+
ideas in the long run, though, and other chemistry-related
|
24
|
+
projects in ruby could benefit from it. See also <b>sciruby</b>.
|
25
|
+
|
26
|
+
For more information, have a look at the other documentation
|
27
|
+
in this file (respectively at
|
28
|
+
https://www.rubydoc.info/gems/chemistry_paradise/
|
29
|
+
).
|
30
|
+
|
31
|
+
## The individual classes in this project
|
32
|
+
|
33
|
+
The individual classes of this project may have their own
|
34
|
+
subsection here, starting with class **CalculateAtomicMass**,
|
35
|
+
which was one of the first classes originally written - I
|
36
|
+
had to calculate the mass of compounds via a pocket
|
37
|
+
calculator. Since I kept doing mistakes doing so, I decided
|
38
|
+
to write some code that will show whether I calculated
|
39
|
+
correctly.
|
40
|
+
|
41
|
+
## class ChemistryParadise::CalculateAtomicMass
|
42
|
+
|
43
|
+
class ChemistryParadise::CalculateAtomicMass will calculate the
|
44
|
+
mass of compounds.
|
45
|
+
|
46
|
+
Argument to this class should be something such as
|
47
|
+
<b>C16H12N2</b>, but you can also use Unicode numbers
|
48
|
+
such as ₃ rather than 3.
|
49
|
+
|
50
|
+
So the following shows valid arguments to the class:
|
51
|
+
|
52
|
+
ChemistryParadise::CalculateAtomicMass.new('C16H12N2')
|
53
|
+
ChemistryParadise::CalculateAtomicMass.new('CH3Cl')
|
54
|
+
ChemistryParadise::CalculateAtomicMass.new('CH₃Cl') # ← This variant also works since as of December 2019.
|
55
|
+
ChemistryParadise::CalculateAtomicMass.new('CO₂') # ← As does this, too, since as of December 2019.
|
56
|
+
|
57
|
+
If you need **english output**, look at the entry default language
|
58
|
+
to use within the project, in this file.
|
59
|
+
|
60
|
+
- **ChemistryParadise::Orbitals** will simply show how many
|
61
|
+
electrons fit into an orbital.
|
62
|
+
|
63
|
+
- The class **ChemistryParadise::ShowElectronConfiguration**
|
64
|
+
will report the electron configuration for the given element.
|
65
|
+
|
66
|
+
For example, if you pass 'Fe' as element (iron), then the
|
67
|
+
class will report something like this:
|
68
|
+
|
69
|
+
Found element Fe. It has 26 electrons.
|
70
|
+
[Ar] 4s2 3d6
|
71
|
+
|
72
|
+
Specific example in pure ruby:
|
73
|
+
|
74
|
+
require 'chemistry_paradise'
|
75
|
+
ChemistryParadise::ShowElectronConfiguration.new('Fe')
|
76
|
+
|
77
|
+
Note that this may not work as well for heavy atoms, but for
|
78
|
+
the more common ~smaller atoms, it should work fine.
|
79
|
+
|
80
|
+
Do note that since as of March 2020 a few chemical substances
|
81
|
+
can be quickly queried by their trivial name, including a
|
82
|
+
few german names.
|
83
|
+
|
84
|
+
Example:
|
85
|
+
|
86
|
+
molmasse harnstoff
|
87
|
+
|
88
|
+
This would be the very same as:
|
89
|
+
|
90
|
+
molmasse CH₄N₂O
|
91
|
+
molmasse CH4N2O
|
92
|
+
|
93
|
+
To output this in english, try:
|
94
|
+
|
95
|
+
molmasse "(NH₄)₂SO₄" --english
|
96
|
+
|
97
|
+
So basically use the **--english** commandline flag.
|
98
|
+
|
99
|
+
## Default language to use within the project
|
100
|
+
|
101
|
+
The project initially showed output mostly in the german language.
|
102
|
+
|
103
|
+
However had - most people may prefer the english language, so a
|
104
|
+
switch exists that allows you to toggle the behaviour of the
|
105
|
+
ChemistryParadise project, in regards to the language at hand.
|
106
|
+
|
107
|
+
If you wish to **use the english language**, you can use the following
|
108
|
+
method call:
|
109
|
+
|
110
|
+
ChemistryParadise.do_use_english
|
111
|
+
|
112
|
+
Also, the Base class allows one to switch between the english
|
113
|
+
and the german language.
|
114
|
+
|
115
|
+
Either way, past this point, if you invoke **class CalculateAtomicMass**,
|
116
|
+
it will then report the result in english. Internally the
|
117
|
+
module-method instance variable called <b>@language</b> will
|
118
|
+
keep track of the language at hand.
|
119
|
+
|
120
|
+
See also the test/ subdirectory to look at this in action.
|
121
|
+
|
122
|
+
## German names of atoms/elements
|
123
|
+
|
124
|
+
In the german language, we can find names such as <b>Quecksilber</b>
|
125
|
+
for the element <b>Hg</b> (mercury, aka <b>hydrargyrum</b>).
|
126
|
+
|
127
|
+
The file <b>german_names_of_elements_to_element_symbol.rb</b>
|
128
|
+
handles this conversion, but you can also query the translated
|
129
|
+
symbol-name from the commandliny, by using a pseudo-regex such
|
130
|
+
as:
|
131
|
+
|
132
|
+
chemistry_paradise /Quecksilber/
|
133
|
+
|
134
|
+
So in other words, the german name of the element at hand is
|
135
|
+
to be put between the two **/** characters.
|
136
|
+
|
137
|
+
The default pseudo-regex may change one day, in which case
|
138
|
+
the change would be properly documented here as well.
|
139
|
+
|
140
|
+
## class ChemistryParadise::ShowElectronNegativityOfThisElement
|
141
|
+
|
142
|
+
<b>class ChemistryParadise::ShowElectronNegativityOfThisElement</b>
|
143
|
+
can be used to show, on the commandline, the **electronegativity**
|
144
|
+
of the given elements.
|
145
|
+
|
146
|
+
So for example, if you'd want to know to know the electron negativity
|
147
|
+
of Fluor and Iron, you'd pass in this:
|
148
|
+
|
149
|
+
ChemistryParadise::ShowElectronNegativityOfThisElement.new(['F','Fe'])
|
150
|
+
|
151
|
+
From the commandline, if you aliased towards the .rb file, simply pass
|
152
|
+
in F and Fe, without any ' quotes.
|
153
|
+
|
154
|
+
If you want another accessor, also from the commandline, then do:
|
155
|
+
|
156
|
+
chemistry_paradise --electronegativity-of=F/Fe
|
157
|
+
|
158
|
+
In that case, <b>/</b> acts as the separator between several elements.
|
159
|
+
|
160
|
+
<b>Always input the element symbol, NOT the long name of the
|
161
|
+
element.</b>
|
162
|
+
|
163
|
+
See **wikipedia** for a complete list of elements.
|
164
|
+
|
165
|
+
If you intent to use this part of the chemistry_paradise project
|
166
|
+
to predict whether two elements form an ionic bond, as a rule of
|
167
|
+
thumb, the difference should be at the very least <b>1.5</b> between
|
168
|
+
the two elements; ideally <b>1.8</b>. Past that point it can
|
169
|
+
be concluded, that two different elements with such a large
|
170
|
+
discrepancy in their electron negativity values, would form
|
171
|
+
<b>ionic bonds</b> (if they would bind to one another in the
|
172
|
+
first place, that is).
|
173
|
+
|
174
|
+
## Showing the individual steps
|
175
|
+
|
176
|
+
If you wish to display the molecular mass of some compound, on
|
177
|
+
the commandline, and would also like to display the individual
|
178
|
+
steps done, you can use the following commandline flag:
|
179
|
+
|
180
|
+
mmasse CaCO3 --show-steps
|
181
|
+
|
182
|
+
Note that this will probably be extended in the future, so
|
183
|
+
that this also works a bit like a **debug-flag**. The idea
|
184
|
+
here is to be able to verify what is going on in a simple
|
185
|
+
manner, rather than to merely rely on the output **assumed**
|
186
|
+
to be correct.
|
187
|
+
|
188
|
+
## class ChemistryParadise::CombustionAnalysis
|
189
|
+
|
190
|
+
**class ChemistryParadise::CombustionAnalysis** can be used
|
191
|
+
to analyse the combustion of a compound.
|
192
|
+
|
193
|
+
Say that you know these values:
|
194
|
+
|
195
|
+
K 28,93%
|
196
|
+
S 23,72%
|
197
|
+
O 47.35%
|
198
|
+
|
199
|
+
K means Kalium aka Sodium (correction in November 2020: Sodium
|
200
|
+
is, of course, Na aka Natrium; not sure why the german name
|
201
|
+
matches, whereas the english one does not, but evidently I
|
202
|
+
made the mistake in assuming that Kalium would be Sodium,
|
203
|
+
which was **evidently** incorrect).
|
204
|
+
|
205
|
+
Note that 28,93% refers to 28.93% of **100%**
|
206
|
+
of the given substance is stored in Kalium.
|
207
|
+
|
208
|
+
Next, we invoke the class from the commandline; I aliased
|
209
|
+
it to **combustionanalysis**.
|
210
|
+
|
211
|
+
combustionanalysis "K 28,93% S 23,72% O 47.35%"
|
212
|
+
|
213
|
+
The output will be:
|
214
|
+
|
215
|
+
**KSO₄**
|
216
|
+
|
217
|
+
combustionanalysis "Al 15,77% O 56,12% S 28,11%" # => Al₂O12S₃
|
218
|
+
|
219
|
+
Note that this may have a few bugs left, for larger compounds
|
220
|
+
or any combustion analysis that is not very correct. But for
|
221
|
+
simple compounds, such as the examples shown above, it should
|
222
|
+
work very well.
|
223
|
+
|
224
|
+
You can use this from ruby code via:
|
225
|
+
|
226
|
+
require 'chemistry_paradise/combustion_analysis.rb'
|
227
|
+
ChemistryParadise::CombustionAnalysis.new(ARGV)
|
228
|
+
|
229
|
+
# To use the example above:
|
230
|
+
ChemistryParadise::CombustionAnalysis.new('Al 15,77% O 56,12% S 28,11%') # => Al₂O₁₂S₃
|
231
|
+
|
232
|
+
## Disclaimer
|
233
|
+
|
234
|
+
Keep in mind that this is merely **a hobby project**, not a
|
235
|
+
"fully fledged professional" suite of code.
|
236
|
+
|
237
|
+
I use it primarily to help me in little things, such as **querying
|
238
|
+
the electron configuration of an atom on the commandline**, or
|
239
|
+
**calculating the molar mass of a compound**. I could do the latter
|
240
|
+
manually, but computers are a lot faster and a lot less work
|
241
|
+
than manual calculations - and more reliable, too. I tend to
|
242
|
+
do errors when typing anything into a calculator.
|
243
|
+
|
244
|
+
As this is not professional chemistry-software, please do not
|
245
|
+
expect that this project could ever really help calculating
|
246
|
+
the **Schroedinger equation** or anything similar to that.
|
247
|
+
|
248
|
+
## Www-related documentation in german and english
|
249
|
+
|
250
|
+
Since as of **January 2021** I have decided to slowly put my
|
251
|
+
local knowledge base about chemistry online. These were
|
252
|
+
mostly stored in .cgi files. I may put them into sinatra
|
253
|
+
as interface eventually; we'll see. Anyway, this is a
|
254
|
+
low priority, ongoing effort, and the german parts will
|
255
|
+
not be too useful for other people - but still, I wanted
|
256
|
+
to publish it, simply because it seems to be more useful
|
257
|
+
when available in combination with ruby code as well..
|
258
|
+
|
259
|
+
Since as of May 2021 there is also a tiny sinatra API
|
260
|
+
available.
|
261
|
+
|
262
|
+
For example, if you start sinatra.rb, and then visit a page
|
263
|
+
such as:
|
264
|
+
|
265
|
+
http://localhost:4567/compound/H2SO4
|
266
|
+
|
267
|
+
The atomic mass of H2SO4 will be calculated and then
|
268
|
+
shown via that web-interface.
|
269
|
+
|
270
|
+
## GUI
|
271
|
+
|
272
|
+
I may in the long run add GUIs similar to this one here:
|
273
|
+
|
274
|
+
http://www.gamgi.org/images/screenshot13_5b.png
|
275
|
+
|
276
|
+
But this is a hobby project, so don't expect too much
|
277
|
+
work going into it. See the image below for how that GUI part
|
278
|
+
currently looks like, in regards to the chemistry_paradise
|
279
|
+
project. This depends on the ruby-gtk3 bindings. Once you
|
280
|
+
have the necessary C-files (glib, atk, pango, cairo, gtk),
|
281
|
+
doing "**gem install gtk3**" should work just fine. On
|
282
|
+
windows this is a bit more tedious though.
|
283
|
+
|
284
|
+
For now have a look at the **gtk3/** subdirectory in this
|
285
|
+
gem. But there isn't that much there. Just buttons with
|
286
|
+
different colours really ... this needs more functionality,
|
287
|
+
evidently! ;-)
|
288
|
+
|
289
|
+
Since as of **February 2021**, if you need to calculate
|
290
|
+
the molecular weight of a compound and want to use a
|
291
|
+
GUI, try:
|
292
|
+
|
293
|
+
require 'chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb'
|
294
|
+
|
295
|
+
ChemistryParadise::GUI::Gtk::CalculateMolecularWeight.run
|
296
|
+
|
297
|
+
This depends on the ruby-gtk3 bindings.
|
298
|
+
|
299
|
+
Or, from the commandline, try:
|
300
|
+
|
301
|
+
chemistry_paradise --gtk-calculate-molecular-weight
|
302
|
+
|
303
|
+
You can also view the periodic table via a ruby-gtk3 wrapper.
|
304
|
+
This currently (**May 2021**) looks like this:
|
305
|
+
|
306
|
+
<img src="https://i.imgur.com/kY95n2d.png">
|
307
|
+
|
308
|
+
The two lower entries can be used to calculate the atomic weight. The
|
309
|
+
example shows H2O aka water. Note that this has a few bugs here and
|
310
|
+
there - it's not quite polished. I only wanted to showcase the prototype
|
311
|
+
really.
|
312
|
+
|
313
|
+
## YAML files (.yml) distributed with this gem
|
314
|
+
|
315
|
+
This subsection will briefly mention the .yml files that
|
316
|
+
are currently (**May 2021**) part of this project.
|
317
|
+
|
318
|
+
**electron_negativity_chart.yml**: This file keeps track of
|
319
|
+
the "Pauling electronegativity scale". In theory this
|
320
|
+
could be used for distance-calculation as well, but
|
321
|
+
it really is just a simple (stupid) file that keeps
|
322
|
+
track of the old Pauling scores.
|
323
|
+
|
324
|
+
**atomgewichte.yml**: This file keeps track of the molecular
|
325
|
+
weight of the individual atoms. The name is still german;
|
326
|
+
not sure if I will change it to english, but for now
|
327
|
+
it'll remain in german, due to historic reasons mostly
|
328
|
+
(this project was started with german output on the
|
329
|
+
commandline, many years ago).
|
330
|
+
|
331
|
+
**colours_for_the_elements.yml**: Here you can specify
|
332
|
+
which colours to use for the ruby-gtk3 widget. This
|
333
|
+
is probably not very important for many people though.
|
334
|
+
|
335
|
+
**molecular_formula_of_different_molecules.yml**: This file
|
336
|
+
may be used to keep track of some common substances,
|
337
|
+
in regards to their formula. Note that not every
|
338
|
+
molecule can be found there, logically; it just showcases
|
339
|
+
a few examples and may then be re-used in different
|
340
|
+
parts, such as the GUI elements.
|
341
|
+
|
342
|
+
## Licence:
|
343
|
+
|
344
|
+
Since as of **June 2021** the licence is now MIT. I encourage folks
|
345
|
+
to contribute code or documentation, but ultimately the project
|
346
|
+
is mostly a "I needed these things done, so I wrote the code,
|
347
|
+
then I moved on to do other things".
|
348
|
+
|
349
|
+
You can see the MIT licence here:
|
350
|
+
|
351
|
+
https://opensource.org/licenses/MIT
|
352
|
+
|
353
|
+
The individual .rb files do not contain that licence header,
|
354
|
+
simply because I can not want to be bothered to read through
|
355
|
+
legalese that doesn't add anything to code or documentation -
|
356
|
+
but if you ever need an "official" licence, it is here stated
|
357
|
+
that the project is now under the MIT licence, and this is
|
358
|
+
also specified in the .gemspec file that is used to create
|
359
|
+
this project - see the .gem file that you can download
|
360
|
+
from **rubygems.org**.
|
361
|
+
|
362
|
+
## Todo list:
|
363
|
+
|
364
|
+
This is just a generic todo list.
|
365
|
+
|
366
|
+
- Add sinatra-bindings so that the above can be used
|
367
|
+
on the www as well.
|
368
|
+
|
369
|
+
- Add fxruby and tk bindings as well.
|
370
|
+
|
371
|
+
- Extend the ruby-gtk3 widgets while retaining support
|
372
|
+
for ruby-gtk2.
|
373
|
+
|
374
|
+
## Calculating the atomic mass of an element
|
375
|
+
|
376
|
+
Let's take the example of the element <b>Mg</b>. It has different
|
377
|
+
isotopes:
|
378
|
+
|
379
|
+
²⁴Mg 78,99% 23,985
|
380
|
+
²⁵Mg 10,00% 24,985
|
381
|
+
²⁶Mg 11,01% 25,983
|
382
|
+
|
383
|
+
To calculate the atomic mass here use the following toplevel API:
|
384
|
+
|
385
|
+
ChemistryParadise.calculate_atomic_mass_based_on_isotope_percentage(78.99, 23.985, 10.00, 24.985, 11.01, 25.983)
|
386
|
+
|
387
|
+
## Potential useful links related to chemistry
|
388
|
+
|
389
|
+
This is another good ruby-library for handling
|
390
|
+
chemistry-related aspects:
|
391
|
+
|
392
|
+
https://github.com/fogonthedowns/rubychem/
|
393
|
+
|
394
|
+
|
395
|
+
## Contact information
|
396
|
+
|
397
|
+
If your creative mind has ideas and specific suggestions to make this
|
398
|
+
gem more useful in general, feel free to drop me an email at any
|
399
|
+
time, via:
|
400
|
+
|
401
|
+
shevy@inbox.lt
|
402
|
+
|
403
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
404
|
+
decided to slowly abandon gmail for various reasons. In part this is because
|
405
|
+
the UI annoys me (on non-chrome browser loading takes too long), but also
|
406
|
+
because of Google's attempt to establish mass surveillance via its
|
407
|
+
federated cohorts sniffing (FLoC). I do not know what happened at Google,
|
408
|
+
but enough is enough - there is only so much you can take while supporting
|
409
|
+
greed. When it comes to data mining done by private groups, ultimately
|
410
|
+
the user became the product.
|
411
|
+
|
412
|
+
Do keep in mind that responding to emails may take some time,
|
413
|
+
depending on the amount of work I may have at that moment, due
|
414
|
+
to reallife time constraints. I will, however had, read feedback
|
415
|
+
eventually. Patches and code changes are welcome too, of course,
|
416
|
+
as long as they are in the spirit of the project at hand, e. g.
|
417
|
+
fitting to the general theme. For this I may make use of github
|
418
|
+
as a discussion site, but this has a low priority right now.
|
419
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for Project Chemistry.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'chemistry_paradise'
|
5
|
+
require 'roebe/toplevel_methods/misc.rb'
|
6
|
+
|
7
|
+
Gem::Specification.new { |s|
|
8
|
+
|
9
|
+
s.name = 'chemistry_paradise'
|
10
|
+
s.version = ChemistryParadise::VERSION
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
12
|
+
|
13
|
+
DESCRIPTION = <<-EOF
|
14
|
+
|
15
|
+
Chemistry-related tasks are gathered in this project.
|
16
|
+
|
17
|
+
The classes in this project may allow you to translate
|
18
|
+
between celsius and fahrenheit (and vice versa), show the
|
19
|
+
mass of elements or compounds and several similar things
|
20
|
+
somewhat related to chemistry.
|
21
|
+
|
22
|
+
For more extensive documentation, see the link at the
|
23
|
+
bottom right side of this webpage, called "Documentation".
|
24
|
+
|
25
|
+
EOF
|
26
|
+
|
27
|
+
s.summary = DESCRIPTION
|
28
|
+
s.description = DESCRIPTION
|
29
|
+
|
30
|
+
s.extra_rdoc_files = %w()
|
31
|
+
|
32
|
+
s.authors = ['Robert A. Heiler']
|
33
|
+
s.email = Roebe.email?
|
34
|
+
s.files = Dir['**/*']
|
35
|
+
s.license = 'MIT'
|
36
|
+
s.homepage = 'https://rubygems.org/gems/chemistry_paradise'
|
37
|
+
|
38
|
+
s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
|
39
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
40
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
41
|
+
|
42
|
+
s.add_dependency 'opn'
|
43
|
+
s.add_dependency 'cliner'
|
44
|
+
s.add_dependency 'colours'
|
45
|
+
|
46
|
+
}
|
data/doc/BUGS.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
This file will keep some known bugs.
|
2
|
+
|
3
|
+
(1) molmasse 'Al(NO3)'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
/Programs/Ruby/1.9.3p448/lib/ruby/site_ruby/1.9.1/chemistry/shared.rb:69:in `convert_parens': undefined method `[]' for nil:NilClass (NoMethodError)
|
8
|
+
from /Programs/Ruby/1.9.3p448/lib/ruby/site_ruby/1.9.1/chemistry/split_molecule_names.rb:19:in `set_input'
|
9
|
+
from /Programs/Ruby/1.9.3p448/lib/ruby/site_ruby/1.9.1/chemistry/split_molecule_names.rb:15:in `initialize'
|
10
|
+
from /Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/SRC/chemistry/lib/chemistry/calculate_atomic_mass.rb:70:in `new'
|
11
|
+
from /Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/SRC/chemistry/lib/chemistry/calculate_atomic_mass.rb:70:in `run'
|
12
|
+
from /Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/SRC/chemistry/lib/chemistry/calculate_atomic_mass.rb:25:in `initialize'
|
13
|
+
from /Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/SRC/chemistry/lib/chemistry/calculate_atomic_mass.rb:110:in `new'
|
14
|
+
from /Users/x/DATA/PROGRAMMING_LANGUAGES/RUBY/SRC/chemistry/lib/chemistry/calculate_atomic_mass.rb:110:in `<main>'
|
15
|
+
|
16
|
+
^^^ BUG! It should not fail.
|