chemistry_paradise 1.1.1
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 +222 -0
- data/bin/chemistry_paradise +7 -0
- data/chemistry_paradise.gemspec +45 -0
- data/doc/BUGS.md +16 -0
- data/doc/README.gen +205 -0
- data/doc/TODO.md +13 -0
- data/lib/chemistry_paradise.rb +6 -0
- data/lib/chemistry_paradise/base/base.rb +101 -0
- data/lib/chemistry_paradise/base/colours.rb +65 -0
- data/lib/chemistry_paradise/calculate_atomic_mass.rb +487 -0
- data/lib/chemistry_paradise/combustion_analysis.rb +181 -0
- data/lib/chemistry_paradise/commandline/help.rb +35 -0
- data/lib/chemistry_paradise/commandline/menu.rb +80 -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 +27 -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 +134 -0
- data/lib/chemistry_paradise/converters/fahrenheit_to_celsius.rb +122 -0
- data/lib/chemistry_paradise/converters/shared.rb +15 -0
- data/lib/chemistry_paradise/electron_negativity_chart.rb +78 -0
- data/lib/chemistry_paradise/equalize_chemical_formula.rb +82 -0
- data/lib/chemistry_paradise/equation_solver.rb +130 -0
- data/lib/chemistry_paradise/interactive_chemistry_shell.rb +241 -0
- data/lib/chemistry_paradise/orbitals.rb +65 -0
- data/lib/chemistry_paradise/project/project_base_directory.rb +24 -0
- data/lib/chemistry_paradise/requires/common_external_requires.rb +17 -0
- data/lib/chemistry_paradise/shared.rb +162 -0
- data/lib/chemistry_paradise/show_electron_configuration.rb +243 -0
- data/lib/chemistry_paradise/show_electron_negativity_of_this_element.rb +101 -0
- data/lib/chemistry_paradise/show_element.rb +141 -0
- data/lib/chemistry_paradise/split_molecule_names.rb +185 -0
- data/lib/chemistry_paradise/toplevel_methods/atomgewichte.rb +31 -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/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/verbose_chemical_calculation.rb +21 -0
- data/lib/chemistry_paradise/version/version.rb +19 -0
- data/lib/chemistry_paradise/yaml/atomgewichte.yml +109 -0
- data/lib/chemistry_paradise/yaml/electron_negativity_chart.yml +109 -0
- data/lib/chemistry_paradise/yaml/molecular_formula_of_different_molecules.yml +12 -0
- data/test/testing_chemistry_paradise.rb +49 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e99c65586a5d3027af380a8c776070f55214685fc5322c99a5db69cfc705218
|
4
|
+
data.tar.gz: 677a39e0dd18b4ab0aed8dce69352411724b4def6be5f0fb4f80675cfeb6280d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6c5b269c53145ed429366471efd37409d8bc73c9e3342b5354f78d13badd0d06a26d04a71fc410c1aaaed94b8aa1d6031dbcf9de7ed253f2499d3f15553e4ae3
|
7
|
+
data.tar.gz: d6d826bb0f93be713d335831aa1694a13ddd72f997a7c38b2b16894c20aee06df67c1b02a11723cd701e797965e03eda16d3bc4e895bfe605928b3ce458340c6
|
data/README.md
ADDED
@@ -0,0 +1,222 @@
|
|
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
|
+
## Introduction
|
6
|
+
|
7
|
+
This project bundles together some commonly used methods and classes
|
8
|
+
related to **chemistry**.
|
9
|
+
|
10
|
+
## The individual classes in this project
|
11
|
+
|
12
|
+
To the individual classes:
|
13
|
+
|
14
|
+
- **CalculateAtomicMass** will calculate the mass.
|
15
|
+
|
16
|
+
Argument to this class should be something such as <b>C16H12N2</b>.
|
17
|
+
|
18
|
+
So:
|
19
|
+
|
20
|
+
ChemistryParadise::CalculateAtomicMass.new('C16H12N2')
|
21
|
+
ChemistryParadise::CalculateAtomicMass.new('CH3Cl')
|
22
|
+
ChemistryParadise::CalculateAtomicMass.new('CH₃Cl') # ← This variant also works since as of December 2019.
|
23
|
+
ChemistryParadise::CalculateAtomicMass.new('CO₂') # ← As does this, too, since as of December 2019.
|
24
|
+
|
25
|
+
If you need **english output**, look at the entry default language
|
26
|
+
to use within the project, in this file.
|
27
|
+
|
28
|
+
- **ChemistryParadise::Orbitals** will simply show how many
|
29
|
+
electrons fit into an orbital.
|
30
|
+
|
31
|
+
- The class **ChemistryParadise::ShowElectronConfiguration**
|
32
|
+
will report the electron configuration for the given element.
|
33
|
+
|
34
|
+
For example, if you pass 'Fe' as element (iron), then the
|
35
|
+
class will report something like this:
|
36
|
+
|
37
|
+
Found element Fe. It has 26 electrons.
|
38
|
+
[Ar] 4s2 3d6
|
39
|
+
|
40
|
+
Specific example in pure ruby:
|
41
|
+
|
42
|
+
require 'chemistry_paradise'
|
43
|
+
ChemistryParadise::ShowElectronConfiguration.new('Fe')
|
44
|
+
|
45
|
+
Note that this may not work as well for heavy atoms, but for
|
46
|
+
the more common ~smaller atoms, it should work fine.
|
47
|
+
|
48
|
+
Do note that since as of March 2020 a few chemical substances
|
49
|
+
can be quickly queried by their trivial name, including a
|
50
|
+
few german names.
|
51
|
+
|
52
|
+
Example:
|
53
|
+
|
54
|
+
molmasse harnstoff
|
55
|
+
|
56
|
+
This would be the very same as:
|
57
|
+
|
58
|
+
molmasse CH₄N₂O
|
59
|
+
molmasse CH4N2O
|
60
|
+
|
61
|
+
## Default language to use within the project
|
62
|
+
|
63
|
+
The project initially showed output mostly in the german language.
|
64
|
+
|
65
|
+
However had - most people may prefer the english language, so a
|
66
|
+
switch exists that allows you to toggle the behaviour of the
|
67
|
+
ChemistryParadise project, in regards to the language at hand.
|
68
|
+
|
69
|
+
If you wish to **use the english language**, you can use the following
|
70
|
+
method call:
|
71
|
+
|
72
|
+
ChemistryParadise.do_use_english
|
73
|
+
|
74
|
+
Also, the Base class allows one to switch between the english
|
75
|
+
and the german language.
|
76
|
+
|
77
|
+
Either way, past this point, if you invoke **class CalculateAtomicMass**,
|
78
|
+
it will then report the result in english. Internally the
|
79
|
+
module-method instance variable called <b>@language</b> will
|
80
|
+
keep track of the language at hand.
|
81
|
+
|
82
|
+
See also the test/ subdirectory to look at this in action.
|
83
|
+
|
84
|
+
## German names of atoms/elements
|
85
|
+
|
86
|
+
In the german language, we can find names such as <b>Quecksilber</b>
|
87
|
+
for the element <b>Hg</b> (mercury, aka <b>hydrargyrum</b>).
|
88
|
+
|
89
|
+
The file <b>german_names_of_elements_to_element_symbol.rb</b>
|
90
|
+
handles this conversion, but you can also query the translated
|
91
|
+
symbol-name from the commandliny, by using a pseudo-regex such
|
92
|
+
as:
|
93
|
+
|
94
|
+
chemistry_paradise /Quecksilber/
|
95
|
+
|
96
|
+
So in other words, the german name of the element at hand is
|
97
|
+
to be put between the two **/** characters.
|
98
|
+
|
99
|
+
The default pseudo-regex may change one day, in which case
|
100
|
+
the change would be properly documented here as well.
|
101
|
+
|
102
|
+
## class ChemistryParadise::ShowElectronNegativityOfThisElement
|
103
|
+
|
104
|
+
<b>class ChemistryParadise::ShowElectronNegativityOfThisElement</b>
|
105
|
+
can be used to show, on the commandline, the **electronegativity**
|
106
|
+
of the given elements.
|
107
|
+
|
108
|
+
So for example, if you'd want to know to know the electron negativity
|
109
|
+
of Fluor and Iron, you'd pass in this:
|
110
|
+
|
111
|
+
ChemistryParadise::ShowElectronNegativityOfThisElement.new(['F','Fe'])
|
112
|
+
|
113
|
+
From the commandline, if you aliased towards the .rb file, simply pass
|
114
|
+
in F and Fe, without any ' quotes.
|
115
|
+
|
116
|
+
If you want another accessor, also from the commandline, then do:
|
117
|
+
|
118
|
+
chemistry_paradise --electronegativity-of=F/Fe
|
119
|
+
|
120
|
+
In that case, <b>/</b> acts as the separator between several elements.
|
121
|
+
|
122
|
+
<b>Always input the element symbol, NOT the long name of the
|
123
|
+
element.</b>
|
124
|
+
|
125
|
+
See **wikipedia** for a complete list of elements.
|
126
|
+
|
127
|
+
If you intent to use this part of the chemistry_paradise project
|
128
|
+
to predict whether two elements form an ionic bond, as a rule of
|
129
|
+
thumb, the difference should be at the very least <b>1.5</b> between
|
130
|
+
the two elements; ideally <b>1.8</b>. Past that point it can
|
131
|
+
be concluded, that two different elements with such a large
|
132
|
+
discrepancy in their electron negativity values, would form
|
133
|
+
<b>ionic bonds</b> (if they would bind to one another in the
|
134
|
+
first place, that is).
|
135
|
+
|
136
|
+
## Showing the individual steps
|
137
|
+
|
138
|
+
If you wish to display the molecular mass of some compound, on
|
139
|
+
the commandline, and would also like to display the individual
|
140
|
+
steps done, you can use the following commandline flag:
|
141
|
+
|
142
|
+
mmasse CaCO3 --show-steps
|
143
|
+
|
144
|
+
Note that this will probably be extended in the future, so
|
145
|
+
that this also works a bit like a **debug-flag**. The idea
|
146
|
+
here is to be able to verify what is going on in a simple
|
147
|
+
manner, rather than to merely rely on the output **assumed**
|
148
|
+
to be correct.
|
149
|
+
|
150
|
+
## class ChemistryParadise::CombustionAnalysis
|
151
|
+
|
152
|
+
**class ChemistryParadise::CombustionAnalysis** can be used
|
153
|
+
to analyse the combustion of a compound.
|
154
|
+
|
155
|
+
Say that you know these values:
|
156
|
+
|
157
|
+
K 28,93%
|
158
|
+
S 23,72%
|
159
|
+
O 47.35%
|
160
|
+
|
161
|
+
K means Kalium aka Sodium (correction in November 2020: Sodium
|
162
|
+
is, of course, Na aka Natrium; not sure why the german name
|
163
|
+
matches, whereas the english one does not, but evidently I
|
164
|
+
made the mistake in assuming that Kalium would be Sodium,
|
165
|
+
which was **evidently** incorrect).
|
166
|
+
|
167
|
+
Note that 28,93% refers to 28.93% of **100%**
|
168
|
+
of the given substance is stored in Kalium.
|
169
|
+
|
170
|
+
Next, we invoke the class from the commandline; I aliased
|
171
|
+
it to **combustionanalysis**.
|
172
|
+
|
173
|
+
combustionanalysis "K 28,93% S 23,72% O 47.35%"
|
174
|
+
|
175
|
+
The output will be:
|
176
|
+
|
177
|
+
**KSO₄**
|
178
|
+
|
179
|
+
combustionanalysis "Al 15,77% O 56,12% S 28,11%" # => Al₂O12S₃
|
180
|
+
|
181
|
+
Note that this may have a few bugs left, for larger compounds
|
182
|
+
or any combustion analysis that is not very correct. But for
|
183
|
+
simple compounds, such as the examples shown above, it should
|
184
|
+
work very well.
|
185
|
+
|
186
|
+
You can use this from ruby code via:
|
187
|
+
|
188
|
+
require 'chemistry_paradise/combustion_analysis.rb'
|
189
|
+
ChemistryParadise::CombustionAnalysis.new(ARGV)
|
190
|
+
|
191
|
+
## Disclaimer
|
192
|
+
|
193
|
+
Keep in mind that this is merely **a hobby project**, not a
|
194
|
+
"fully fledged professional" suite of code.
|
195
|
+
|
196
|
+
I use it primarily to help me in little things, such as **querying
|
197
|
+
the electron configuration of an atom on the commandline**, or
|
198
|
+
**calculating the molar mass of a compound**. I could do the latter
|
199
|
+
manually, but computers are a lot faster and a lot less work
|
200
|
+
than manual calculations - and more reliable, too. I tend to
|
201
|
+
do errors when typing anything into a calculator.
|
202
|
+
|
203
|
+
As this is not professional chemistry-software, please do not
|
204
|
+
expect that this project could ever really help calculating
|
205
|
+
the **Schroedinger equation** or anything similar to that.
|
206
|
+
|
207
|
+
|
208
|
+
## Contact information
|
209
|
+
|
210
|
+
If your creative mind has ideas and specific suggestions to make this
|
211
|
+
gem more useful in general, feel free to drop me an email at any
|
212
|
+
time, via:
|
213
|
+
|
214
|
+
shevegen@gmail.com
|
215
|
+
|
216
|
+
(Do keep in mind that responding to emails may take some time, depending
|
217
|
+
on the amount of work I may have at that moment, due to reallife. I will,
|
218
|
+
however had, read feedback. Patches and code changes are welcome too
|
219
|
+
of course, as long as they are in the spirit of the project at
|
220
|
+
hand, e. g. fitting to the general theme.)
|
221
|
+
|
222
|
+
Thank you.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for Project Chemistry.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'chemistry_paradise'
|
5
|
+
|
6
|
+
Gem::Specification.new { |s|
|
7
|
+
|
8
|
+
s.name = 'chemistry_paradise'
|
9
|
+
s.version = ChemistryParadise::VERSION
|
10
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
11
|
+
|
12
|
+
DESCRIPTION = <<-EOF
|
13
|
+
|
14
|
+
Chemistry-related tasks are gathered in this project.
|
15
|
+
|
16
|
+
The classes in this project may allow you to translate
|
17
|
+
between celsius and fahrenheit (and vice versa), show the
|
18
|
+
mass of elements or compounds and several similar things
|
19
|
+
somewhat related to chemistry.
|
20
|
+
|
21
|
+
For more extensive documentation, see the link at the
|
22
|
+
bottom right side of this webpage, called "Documentation".
|
23
|
+
|
24
|
+
EOF
|
25
|
+
|
26
|
+
s.summary = DESCRIPTION
|
27
|
+
s.description = DESCRIPTION
|
28
|
+
|
29
|
+
s.extra_rdoc_files = %w()
|
30
|
+
|
31
|
+
s.authors = ['Robert A. Heiler']
|
32
|
+
s.email = 'shevegen@gmail.com'
|
33
|
+
s.files = Dir['**/*']
|
34
|
+
s.license = 'GPL-2.0'
|
35
|
+
s.homepage = 'http://rubygems.org/gems/chemistry'
|
36
|
+
|
37
|
+
s.required_ruby_version = '>= '+RUBY_VERSION
|
38
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
39
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
40
|
+
|
41
|
+
s.add_dependency 'opn'
|
42
|
+
s.add_dependency 'cliner'
|
43
|
+
s.add_dependency 'colours'
|
44
|
+
|
45
|
+
}
|
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.
|
data/doc/README.gen
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
ADD_RUBY_BADGES
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
This project bundles together some commonly used methods and classes
|
6
|
+
related to **chemistry**.
|
7
|
+
|
8
|
+
## The individual classes in this project
|
9
|
+
|
10
|
+
To the individual classes:
|
11
|
+
|
12
|
+
- **CalculateAtomicMass** will calculate the mass.
|
13
|
+
|
14
|
+
Argument to this class should be something such as <b>C16H12N2</b>.
|
15
|
+
|
16
|
+
So:
|
17
|
+
|
18
|
+
ChemistryParadise::CalculateAtomicMass.new('C16H12N2')
|
19
|
+
ChemistryParadise::CalculateAtomicMass.new('CH3Cl')
|
20
|
+
ChemistryParadise::CalculateAtomicMass.new('CH₃Cl') # ← This variant also works since as of December 2019.
|
21
|
+
ChemistryParadise::CalculateAtomicMass.new('CO₂') # ← As does this, too, since as of December 2019.
|
22
|
+
|
23
|
+
If you need **english output**, look at the entry default language
|
24
|
+
to use within the project, in this file.
|
25
|
+
|
26
|
+
- **ChemistryParadise::Orbitals** will simply show how many
|
27
|
+
electrons fit into an orbital.
|
28
|
+
|
29
|
+
- The class **ChemistryParadise::ShowElectronConfiguration**
|
30
|
+
will report the electron configuration for the given element.
|
31
|
+
|
32
|
+
For example, if you pass 'Fe' as element (iron), then the
|
33
|
+
class will report something like this:
|
34
|
+
|
35
|
+
Found element Fe. It has 26 electrons.
|
36
|
+
[Ar] 4s2 3d6
|
37
|
+
|
38
|
+
Specific example in pure ruby:
|
39
|
+
|
40
|
+
require 'chemistry_paradise'
|
41
|
+
ChemistryParadise::ShowElectronConfiguration.new('Fe')
|
42
|
+
|
43
|
+
Note that this may not work as well for heavy atoms, but for
|
44
|
+
the more common ~smaller atoms, it should work fine.
|
45
|
+
|
46
|
+
Do note that since as of March 2020 a few chemical substances
|
47
|
+
can be quickly queried by their trivial name, including a
|
48
|
+
few german names.
|
49
|
+
|
50
|
+
Example:
|
51
|
+
|
52
|
+
molmasse harnstoff
|
53
|
+
|
54
|
+
This would be the very same as:
|
55
|
+
|
56
|
+
molmasse CH₄N₂O
|
57
|
+
molmasse CH4N2O
|
58
|
+
|
59
|
+
## Default language to use within the project
|
60
|
+
|
61
|
+
The project initially showed output mostly in the german language.
|
62
|
+
|
63
|
+
However had - most people may prefer the english language, so a
|
64
|
+
switch exists that allows you to toggle the behaviour of the
|
65
|
+
ChemistryParadise project, in regards to the language at hand.
|
66
|
+
|
67
|
+
If you wish to **use the english language**, you can use the following
|
68
|
+
method call:
|
69
|
+
|
70
|
+
ChemistryParadise.do_use_english
|
71
|
+
|
72
|
+
Also, the Base class allows one to switch between the english
|
73
|
+
and the german language.
|
74
|
+
|
75
|
+
Either way, past this point, if you invoke **class CalculateAtomicMass**,
|
76
|
+
it will then report the result in english. Internally the
|
77
|
+
module-method instance variable called <b>@language</b> will
|
78
|
+
keep track of the language at hand.
|
79
|
+
|
80
|
+
See also the test/ subdirectory to look at this in action.
|
81
|
+
|
82
|
+
## German names of atoms/elements
|
83
|
+
|
84
|
+
In the german language, we can find names such as <b>Quecksilber</b>
|
85
|
+
for the element <b>Hg</b> (mercury, aka <b>hydrargyrum</b>).
|
86
|
+
|
87
|
+
The file <b>german_names_of_elements_to_element_symbol.rb</b>
|
88
|
+
handles this conversion, but you can also query the translated
|
89
|
+
symbol-name from the commandliny, by using a pseudo-regex such
|
90
|
+
as:
|
91
|
+
|
92
|
+
chemistry_paradise /Quecksilber/
|
93
|
+
|
94
|
+
So in other words, the german name of the element at hand is
|
95
|
+
to be put between the two **/** characters.
|
96
|
+
|
97
|
+
The default pseudo-regex may change one day, in which case
|
98
|
+
the change would be properly documented here as well.
|
99
|
+
|
100
|
+
## class ChemistryParadise::ShowElectronNegativityOfThisElement
|
101
|
+
|
102
|
+
<b>class ChemistryParadise::ShowElectronNegativityOfThisElement</b>
|
103
|
+
can be used to show, on the commandline, the **electronegativity**
|
104
|
+
of the given elements.
|
105
|
+
|
106
|
+
So for example, if you'd want to know to know the electron negativity
|
107
|
+
of Fluor and Iron, you'd pass in this:
|
108
|
+
|
109
|
+
ChemistryParadise::ShowElectronNegativityOfThisElement.new(['F','Fe'])
|
110
|
+
|
111
|
+
From the commandline, if you aliased towards the .rb file, simply pass
|
112
|
+
in F and Fe, without any ' quotes.
|
113
|
+
|
114
|
+
If you want another accessor, also from the commandline, then do:
|
115
|
+
|
116
|
+
chemistry_paradise --electronegativity-of=F/Fe
|
117
|
+
|
118
|
+
In that case, <b>/</b> acts as the separator between several elements.
|
119
|
+
|
120
|
+
<b>Always input the element symbol, NOT the long name of the
|
121
|
+
element.</b>
|
122
|
+
|
123
|
+
See **wikipedia** for a complete list of elements.
|
124
|
+
|
125
|
+
If you intent to use this part of the chemistry_paradise project
|
126
|
+
to predict whether two elements form an ionic bond, as a rule of
|
127
|
+
thumb, the difference should be at the very least <b>1.5</b> between
|
128
|
+
the two elements; ideally <b>1.8</b>. Past that point it can
|
129
|
+
be concluded, that two different elements with such a large
|
130
|
+
discrepancy in their electron negativity values, would form
|
131
|
+
<b>ionic bonds</b> (if they would bind to one another in the
|
132
|
+
first place, that is).
|
133
|
+
|
134
|
+
## Showing the individual steps
|
135
|
+
|
136
|
+
If you wish to display the molecular mass of some compound, on
|
137
|
+
the commandline, and would also like to display the individual
|
138
|
+
steps done, you can use the following commandline flag:
|
139
|
+
|
140
|
+
mmasse CaCO3 --show-steps
|
141
|
+
|
142
|
+
Note that this will probably be extended in the future, so
|
143
|
+
that this also works a bit like a **debug-flag**. The idea
|
144
|
+
here is to be able to verify what is going on in a simple
|
145
|
+
manner, rather than to merely rely on the output **assumed**
|
146
|
+
to be correct.
|
147
|
+
|
148
|
+
## class ChemistryParadise::CombustionAnalysis
|
149
|
+
|
150
|
+
**class ChemistryParadise::CombustionAnalysis** can be used
|
151
|
+
to analyse the combustion of a compound.
|
152
|
+
|
153
|
+
Say that you know these values:
|
154
|
+
|
155
|
+
K 28,93%
|
156
|
+
S 23,72%
|
157
|
+
O 47.35%
|
158
|
+
|
159
|
+
K means Kalium aka Sodium (correction in November 2020: Sodium
|
160
|
+
is, of course, Na aka Natrium; not sure why the german name
|
161
|
+
matches, whereas the english one does not, but evidently I
|
162
|
+
made the mistake in assuming that Kalium would be Sodium,
|
163
|
+
which was **evidently** incorrect).
|
164
|
+
|
165
|
+
Note that 28,93% refers to 28.93% of **100%**
|
166
|
+
of the given substance is stored in Kalium.
|
167
|
+
|
168
|
+
Next, we invoke the class from the commandline; I aliased
|
169
|
+
it to **combustionanalysis**.
|
170
|
+
|
171
|
+
combustionanalysis "K 28,93% S 23,72% O 47.35%"
|
172
|
+
|
173
|
+
The output will be:
|
174
|
+
|
175
|
+
**KSO₄**
|
176
|
+
|
177
|
+
combustionanalysis "Al 15,77% O 56,12% S 28,11%" # => Al₂O12S₃
|
178
|
+
|
179
|
+
Note that this may have a few bugs left, for larger compounds
|
180
|
+
or any combustion analysis that is not very correct. But for
|
181
|
+
simple compounds, such as the examples shown above, it should
|
182
|
+
work very well.
|
183
|
+
|
184
|
+
You can use this from ruby code via:
|
185
|
+
|
186
|
+
require 'chemistry_paradise/combustion_analysis.rb'
|
187
|
+
ChemistryParadise::CombustionAnalysis.new(ARGV)
|
188
|
+
|
189
|
+
## Disclaimer
|
190
|
+
|
191
|
+
Keep in mind that this is merely **a hobby project**, not a
|
192
|
+
"fully fledged professional" suite of code.
|
193
|
+
|
194
|
+
I use it primarily to help me in little things, such as **querying
|
195
|
+
the electron configuration of an atom on the commandline**, or
|
196
|
+
**calculating the molar mass of a compound**. I could do the latter
|
197
|
+
manually, but computers are a lot faster and a lot less work
|
198
|
+
than manual calculations - and more reliable, too. I tend to
|
199
|
+
do errors when typing anything into a calculator.
|
200
|
+
|
201
|
+
As this is not professional chemistry-software, please do not
|
202
|
+
expect that this project could ever really help calculating
|
203
|
+
the **Schroedinger equation** or anything similar to that.
|
204
|
+
|
205
|
+
ADD_CONTACT_INFORMATION
|