chemistry_paradise 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +657 -0
  3. data/bin/chemistry_paradise +7 -0
  4. data/bin/wetter +7 -0
  5. data/chemistry_paradise.gemspec +46 -0
  6. data/doc/README.gen +595 -0
  7. data/doc/bugs/BUGS.md +16 -0
  8. data/doc/formulas/biochemical_calculations.md +5 -0
  9. data/doc/todo/todo_for_the_chemistry_paradise_project.md +33 -0
  10. data/doc/todo/todo_for_the_wetter_project.md +7 -0
  11. data/lib/chemistry_paradise/base/base.rb +215 -0
  12. data/lib/chemistry_paradise/base/colours.rb +93 -0
  13. data/lib/chemistry_paradise/commandline/help.rb +40 -0
  14. data/lib/chemistry_paradise/commandline/menu.rb +88 -0
  15. data/lib/chemistry_paradise/commandline/parse_commandline.rb +94 -0
  16. data/lib/chemistry_paradise/constants/constants.rb +77 -0
  17. data/lib/chemistry_paradise/constants/constants_for_chemical_formulas.rb +16 -0
  18. data/lib/chemistry_paradise/constants/file_constants.rb +33 -0
  19. data/lib/chemistry_paradise/constants/german_names_of_elements_to_element_symbol.rb +157 -0
  20. data/lib/chemistry_paradise/converters/celsius_to_fahrenheit.rb +143 -0
  21. data/lib/chemistry_paradise/converters/celsius_to_kelvin.rb +125 -0
  22. data/lib/chemistry_paradise/converters/fahrenheit_to_celsius.rb +132 -0
  23. data/lib/chemistry_paradise/converters/shared.rb +21 -0
  24. data/lib/chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb +34 -0
  25. data/lib/chemistry_paradise/gui/gtk3/show_periodic_table/show_periodic_table.rb +34 -0
  26. data/lib/chemistry_paradise/gui/gtk3/temperature_converter/temperature_converter.rb +112 -0
  27. data/lib/chemistry_paradise/gui/gtk3/wetter/wetter.rb +119 -0
  28. data/lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb +100 -0
  29. data/lib/chemistry_paradise/gui/libui/wetter/wetter.rb +47 -0
  30. data/lib/chemistry_paradise/gui/shared_code/calculate_molecular_weight/calculate_molecular_weight_module.rb +171 -0
  31. data/lib/chemistry_paradise/gui/shared_code/show_periodic_table/show_periodic_table_module.rb +318 -0
  32. data/lib/chemistry_paradise/gui/shared_code/temperature_converter/temperature_converter_module.rb +192 -0
  33. data/lib/chemistry_paradise/gui/shared_code/wetter/wetter_module.rb +349 -0
  34. data/lib/chemistry_paradise/gui/swing/TemperatureConverter$1.class +0 -0
  35. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.class +0 -0
  36. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.java +133 -0
  37. data/lib/chemistry_paradise/gui/unified_widgets/wetter/wetter.rb +62 -0
  38. data/lib/chemistry_paradise/images/show_periodic_table.png +0 -0
  39. data/lib/chemistry_paradise/images/vienna_map.png +0 -0
  40. data/lib/chemistry_paradise/interactive_chemistry_shell.rb +246 -0
  41. data/lib/chemistry_paradise/project/project.rb +24 -0
  42. data/lib/chemistry_paradise/requires/common_external_requires.rb +17 -0
  43. data/lib/chemistry_paradise/requires/require_the_project.rb +21 -0
  44. data/lib/chemistry_paradise/requires/require_the_project_including_the_graphical_user_interface.rb +7 -0
  45. data/lib/chemistry_paradise/requires/require_the_project_including_the_web_interface.rb +4 -0
  46. data/lib/chemistry_paradise/shared.rb +130 -0
  47. data/lib/chemistry_paradise/show_electron_configuration.rb +250 -0
  48. data/lib/chemistry_paradise/show_element.rb +145 -0
  49. data/lib/chemistry_paradise/sinatra/sinatra.rb +131 -0
  50. data/lib/chemistry_paradise/sinatra/wetter/app.rb +68 -0
  51. data/lib/chemistry_paradise/sinatra/wetter/start_sinatra_interface.rb +31 -0
  52. data/lib/chemistry_paradise/split_molecule_names.rb +228 -0
  53. data/lib/chemistry_paradise/toplevel_methods/atomgewichte.rb +31 -0
  54. data/lib/chemistry_paradise/toplevel_methods/convert_parens.rb +64 -0
  55. data/lib/chemistry_paradise/toplevel_methods/display_where_the_molmasses_are_kept.rb +24 -0
  56. data/lib/chemistry_paradise/toplevel_methods/e.rb +16 -0
  57. data/lib/chemistry_paradise/toplevel_methods/kelvin.rb +34 -0
  58. data/lib/chemistry_paradise/toplevel_methods/language.rb +50 -0
  59. data/lib/chemistry_paradise/toplevel_methods/misc.rb +228 -0
  60. data/lib/chemistry_paradise/toplevel_methods/periodic_table.rb +16 -0
  61. data/lib/chemistry_paradise/toplevel_methods/remove_this_molecule_from.rb +63 -0
  62. data/lib/chemistry_paradise/toplevel_methods/roebe.rb +16 -0
  63. data/lib/chemistry_paradise/toplevel_methods/show_electron_negativity_chart.rb +26 -0
  64. data/lib/chemistry_paradise/utility_scripts/calculate_atomic_mass.rb +559 -0
  65. data/lib/chemistry_paradise/utility_scripts/combustion_analysis.rb +207 -0
  66. data/lib/chemistry_paradise/utility_scripts/electron_negativity_chart.rb +78 -0
  67. data/lib/chemistry_paradise/utility_scripts/equalize_chemical_formula.rb +84 -0
  68. data/lib/chemistry_paradise/utility_scripts/equation_solver.rb +130 -0
  69. data/lib/chemistry_paradise/utility_scripts/orbitals.rb +70 -0
  70. data/lib/chemistry_paradise/utility_scripts/show_electron_negativity_of_this_element.rb +103 -0
  71. data/lib/chemistry_paradise/utility_scripts/show_periodic_table.rb +996 -0
  72. data/lib/chemistry_paradise/verbose_chemical_calculation.rb +21 -0
  73. data/lib/chemistry_paradise/version/version.rb +19 -0
  74. data/lib/chemistry_paradise/wetter/wetter.rb +539 -0
  75. data/lib/chemistry_paradise/www/wetter/embeddable_interface.rb +78 -0
  76. data/lib/chemistry_paradise/www/wetter/wetter.cgi +28 -0
  77. data/lib/chemistry_paradise/yaml/atomgewichte.yml +139 -0
  78. data/lib/chemistry_paradise/yaml/colours_for_the_elements.yml +13 -0
  79. data/lib/chemistry_paradise/yaml/dichte.yml +21 -0
  80. data/lib/chemistry_paradise/yaml/electron_negativity_chart.yml +111 -0
  81. data/lib/chemistry_paradise/yaml/molecular_formula_of_different_molecules.yml +13 -0
  82. data/lib/chemistry_paradise/yaml/periodic_table_of_the_elements.yml +125 -0
  83. data/lib/chemistry_paradise.rb +1 -0
  84. data/test/testing_chemistry_paradise.rb +49 -0
  85. metadata +175 -0
@@ -0,0 +1,7 @@
1
+ (1) Integrate a GUI such as this one here:
2
+
3
+ https://github.com/ralph-schleicher/atmosphere-calculator
4
+
5
+ ----------------------------------------------------------
6
+ (2) Add ruby-tk bindings; and then improve on the libui
7
+ stuff; and add gosu bindings as well.
@@ -0,0 +1,215 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'chemistry_paradise/base/base.rb'; < ::ChemistryParadise::Base
6
+ # =========================================================================== #
7
+ require 'chemistry_paradise/base/colours.rb'
8
+
9
+ module ChemistryParadise
10
+
11
+ class Base # === ChemistryParadise::Base
12
+
13
+ require 'chemistry_paradise/project/project.rb'
14
+
15
+ require 'chemistry_paradise/constants/constants.rb'
16
+ include ChemistryParadise::Constants
17
+
18
+ require 'chemistry_paradise/toplevel_methods/roebe.rb'
19
+ require 'chemistry_paradise/toplevel_methods/language.rb'
20
+ require 'chemistry_paradise/constants/german_names_of_elements_to_element_symbol.rb'
21
+
22
+ require 'chemistry_paradise/shared.rb'
23
+ include ChemistryParadise::Shared
24
+
25
+ alias ee print
26
+
27
+ # ========================================================================= #
28
+ # === NAMESPACE
29
+ # ========================================================================= #
30
+ NAMESPACE = inspect
31
+
32
+ # ========================================================================= #
33
+ # === FILE_MOLECULAR_FORMULA_OF_DIFFERENT_MOLECULES
34
+ # ========================================================================= #
35
+ FILE_MOLECULAR_FORMULA_OF_DIFFERENT_MOLECULES =
36
+ "#{PROJECT_BASE_DIRECTORY}yaml/molecular_formula_of_different_molecules.yml"
37
+
38
+ # ========================================================================= #
39
+ # === reset (reset tag)
40
+ # ========================================================================= #
41
+ def reset
42
+ # ======================================================================= #
43
+ # === @be_verbose
44
+ # ======================================================================= #
45
+ @be_verbose = true
46
+ end
47
+
48
+ # ========================================================================= #
49
+ # === initialize_the_internal_hash
50
+ # ========================================================================= #
51
+ def initialize_the_internal_hash
52
+ # ======================================================================= #
53
+ # === @internal_hash
54
+ # ======================================================================= #
55
+ @internal_hash = {}
56
+ end
57
+
58
+ # ========================================================================= #
59
+ # === internal_hash?
60
+ # ========================================================================= #
61
+ def internal_hash?
62
+ @internal_hash
63
+ end; alias internal_hash internal_hash? # === internal_hash
64
+
65
+ # ========================================================================= #
66
+ # === opnn
67
+ # ========================================================================= #
68
+ def opnn(i)
69
+ if i.is_a? String
70
+ i = { namespace: i }
71
+ end
72
+ Opn.opn(i) # Delegate to module Opn here.
73
+ end
74
+
75
+ # ========================================================================= #
76
+ # === use_which_language?
77
+ # ========================================================================= #
78
+ def use_which_language?
79
+ ::ChemistryParadise.use_which_language?
80
+ end
81
+
82
+ # ========================================================================= #
83
+ # === do_we_use_english?
84
+ #
85
+ # Query method to determine whether we will use english or whether
86
+ # we will use another language, for a project-wide setting.
87
+ # ========================================================================= #
88
+ def do_we_use_english?
89
+ (use_which_language? == :english)
90
+ end
91
+
92
+ # ========================================================================= #
93
+ # === set_commandline_arguments
94
+ # ========================================================================= #
95
+ def set_commandline_arguments(i = '')
96
+ i = [i].flatten.compact
97
+ @commandline_arguments = i
98
+ end
99
+
100
+ # ========================================================================= #
101
+ # === commandline_arguments?
102
+ # ========================================================================= #
103
+ def commandline_arguments?
104
+ @commandline_arguments
105
+ end
106
+
107
+ # ========================================================================= #
108
+ # === first_argument?
109
+ # ========================================================================= #
110
+ def first_argument?
111
+ @commandline_arguments.first
112
+ end; alias first? first_argument? # === first?
113
+
114
+ # ========================================================================= #
115
+ # === do_use_the_german_language
116
+ # ========================================================================= #
117
+ def do_use_the_german_language
118
+ ::ChemistryParadise.do_use_german
119
+ end
120
+
121
+ # ========================================================================= #
122
+ # === do_use_the_english_language
123
+ # ========================================================================= #
124
+ def do_use_the_english_language
125
+ ::ChemistryParadise.do_use_english
126
+ end
127
+
128
+ # ========================================================================= #
129
+ # === cliner
130
+ #
131
+ # This variant will return rather than output/display.
132
+ # ========================================================================= #
133
+ def cliner
134
+ '=' * 80
135
+ end
136
+
137
+ # ========================================================================= #
138
+ # === cd (cd tag)
139
+ # ========================================================================= #
140
+ def cd(i)
141
+ Dir.chdir(i)
142
+ end
143
+
144
+ # ========================================================================= #
145
+ # === esystem (system tag)
146
+ # ========================================================================= #
147
+ def esystem(
148
+ i,
149
+ silence_output_from_system = false,
150
+ &block
151
+ )
152
+ yielded = nil
153
+ if block_given?
154
+ yielded = yield
155
+ end
156
+ case yielded
157
+ # ======================================================================= #
158
+ # === :be_quiet
159
+ # ======================================================================= #
160
+ when :be_quiet
161
+ else # This is the default.
162
+ puts i
163
+ end
164
+ case silence_output_from_system
165
+ # ======================================================================= #
166
+ # === :silence_output_from_system
167
+ # ======================================================================= #
168
+ when :silence_output_from_system
169
+ silence_output_from_system = true
170
+ end
171
+ if silence_output_from_system
172
+ # system i, out: File::NULL
173
+ `#{i} 2>&1`
174
+ else
175
+ system i
176
+ end
177
+ end
178
+
179
+ # ========================================================================= #
180
+ # === is_on_roebe?
181
+ # ========================================================================= #
182
+ def is_on_roebe?
183
+ ChemistryParadise.is_on_roebe?
184
+ end
185
+
186
+ # ========================================================================= #
187
+ # === namespace?
188
+ # ========================================================================= #
189
+ def namespace?
190
+ @namespace
191
+ end
192
+
193
+ # ========================================================================= #
194
+ # === set_be_verbose
195
+ # ========================================================================= #
196
+ def set_be_verbose
197
+ @be_verbose = true
198
+ end
199
+
200
+ # ========================================================================= #
201
+ # === be_quiet
202
+ # ========================================================================= #
203
+ def be_quiet
204
+ @be_verbose = false
205
+ end; alias be_silent be_quiet # === be_silent
206
+ alias set_be_quiet be_quiet # === set_be_quiet
207
+
208
+ # ========================================================================= #
209
+ # === be_verbose?
210
+ # ========================================================================= #
211
+ def be_verbose?
212
+ @be_verbose
213
+ end; alias be_verbose be_verbose? # === be_verbose
214
+
215
+ end; end
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'chemistry_paradise/base/colours.rb'
6
+ # =========================================================================== #
7
+ module ChemistryParadise
8
+
9
+ class Base # === ChemistryParadise::Base
10
+
11
+ begin
12
+ require 'colours/html_colours'
13
+ include Colours
14
+ rescue LoadError; end
15
+
16
+ # ========================================================================= #
17
+ # === rev
18
+ # ========================================================================= #
19
+ def rev
20
+ ::Colours.rev
21
+ end
22
+
23
+ # ========================================================================= #
24
+ # === sfancy
25
+ # ========================================================================= #
26
+ def sfancy(i = '')
27
+ ::Colours.sfancy(i)
28
+ end
29
+
30
+ # ========================================================================= #
31
+ # === grey
32
+ # ========================================================================= #
33
+ def grey(i = '')
34
+ "#{::Colours::GREY}#{i}#{Colours}#{rev}"
35
+ end
36
+
37
+ # ========================================================================= #
38
+ # === steelblue
39
+ # ========================================================================= #
40
+ def steelblue(i = '')
41
+ ::Colours.steelblue(i)
42
+ end
43
+
44
+ # ========================================================================= #
45
+ # === yellow
46
+ # ========================================================================= #
47
+ def yellow(i = '')
48
+ ::Colours.yellow(i)
49
+ end
50
+
51
+ # ========================================================================= #
52
+ # === teal
53
+ # ========================================================================= #
54
+ def teal(i = '')
55
+ ::Colours.teal(i)
56
+ end
57
+
58
+ # ========================================================================= #
59
+ # === tomato
60
+ # ========================================================================= #
61
+ def tomato(i = '')
62
+ ::Colours.tomato(i)
63
+ end
64
+
65
+ # ========================================================================= #
66
+ # === royalblue
67
+ # ========================================================================= #
68
+ def royalblue(i = '')
69
+ ::Colours.royalblue(i)
70
+ end
71
+
72
+ # ========================================================================= #
73
+ # === mediumpurple
74
+ # ========================================================================= #
75
+ def mediumpurple(i = '')
76
+ ::Colours.mediumpurple(i)
77
+ end
78
+
79
+ # ========================================================================= #
80
+ # === olivedrab
81
+ # ========================================================================= #
82
+ def olivedrab(i = '')
83
+ ::Colours.olivedrab(i)
84
+ end
85
+
86
+ # ========================================================================= #
87
+ # === gold
88
+ # ========================================================================= #
89
+ def gold(i = '')
90
+ ::Colours.gold(i)
91
+ end
92
+
93
+ end; end
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'chemistry_paradise/commandline/help.rb'
6
+ # =========================================================================== #
7
+ module ChemistryParadise
8
+
9
+ class ParseCommandline < ::ChemistryParadise::Base
10
+
11
+ # ========================================================================= #
12
+ # === show_help
13
+ #
14
+ # The help options can be queried via:
15
+ #
16
+ # chemistry_paradise --help
17
+ #
18
+ # ========================================================================= #
19
+ def show_help
20
+ e 'The following options are documented:'
21
+ e
22
+ e ' --molmassen? # show '\
23
+ 'where the molmasses are kept (a file)'
24
+ e ' --electronegativity-of=F/Fe # report '\
25
+ 'the electronegativitiy of the elements F '\
26
+ 'and Fe (Fluor and Iron)'
27
+ e ' --show_electron_negativity_chart # show '\
28
+ 'the electron negativity chart of the atoms'
29
+ e ' --gtk-calculate-molecular-weight # to start '\
30
+ 'the ruby-gtk3 wrapper for calculating the '\
31
+ 'weight of compounds'
32
+ e ' /Quecksilber/ # use '\
33
+ 'a pseudo-regex to obtain the element-symbol '\
34
+ 'from a german name'
35
+ e ' ^^^ the above // is called a pseudo-regex; pseudo '\
36
+ 'because it is actually a String and not a regex'
37
+ e
38
+ end
39
+
40
+ end; end
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::ParseCommandline
6
+ # =========================================================================== #
7
+ # require 'chemistry_paradise/commandline/menu.rb'
8
+ # =========================================================================== #
9
+ require 'chemistry_paradise/base/base.rb'
10
+
11
+ module ChemistryParadise
12
+
13
+ class ParseCommandline < ::ChemistryParadise::Base # === ChemistryParadise::ParseCommandline
14
+
15
+ require 'chemistry_paradise/toplevel_methods/display_where_the_molmasses_are_kept.rb'
16
+ require 'chemistry_paradise/toplevel_methods/show_electron_negativity_chart.rb'
17
+ require 'chemistry_paradise/utility_scripts/show_electron_negativity_of_this_element.rb'
18
+
19
+ # ========================================================================= #
20
+ # === menu (menu tag)
21
+ # ========================================================================= #
22
+ def menu(
23
+ i = @commandline
24
+ )
25
+ if i.is_a? Array
26
+ i.each {|entry| menu(entry) }
27
+ else
28
+ case i
29
+ # ===================================================================== #
30
+ # === chemistry_paradise --gtk-calculate-molecular-weight
31
+ # ===================================================================== #
32
+ when /^-?-?gtk(_|-)?calculate(_|-)?molecular(_|-)?weight$/i
33
+ require 'chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb'
34
+ ChemistryParadise::GUI::Gtk::CalculateMolecularWeight.run
35
+ exit
36
+ # ===================================================================== #
37
+ # === chemistry_paradise --periodic-table
38
+ # ===================================================================== #
39
+ when /^-?-?periodic(_|-)?table$/i
40
+ show_the_periodic_table
41
+ exit
42
+ # ===================================================================== #
43
+ # === chemistry_paradise --electronegativity-of=F/Fe
44
+ # ===================================================================== #
45
+ when /-?-?electronegativity(_|-)?of=(.+)/
46
+ these_elements = $2.to_s.dup.strip
47
+ if these_elements.include? '/'
48
+ these_elements = these_elements.split('/')
49
+ end
50
+ ChemistryParadise::ShowElectronNegativityOfThisElement.new(these_elements)
51
+ # ===================================================================== #
52
+ # === chemistry_paradise show_electron_negativity_chart
53
+ # ===================================================================== #
54
+ when /show(_|-)?electron(_|-)?negativity(_|-)?chart/
55
+ show_electron_negativity_chart
56
+ # ===================================================================== #
57
+ # === chemistry_paradise test_which_molecules?
58
+ # ===================================================================== #
59
+ when /test(_|-)?which(_|-)?molecules\??/
60
+ pp ARRAY_TEST_THESE_MOLECULES
61
+ # ===================================================================== #
62
+ # === chemistry_paradise --molmassen?
63
+ # ===================================================================== #
64
+ when /molmassen\??/,
65
+ /display(_|-)?molmassen(_|-)?file/,
66
+ /display(_|-)?where(_|-)?the(_|-)?molmasses(_|-)?are(_|-)?kept/
67
+ ::ChemistryParadise.display_where_the_molmasses_are_kept
68
+ # ===================================================================== #
69
+ # === chemistry_paradise --help
70
+ # ===================================================================== #
71
+ when /^-?-?help/
72
+ show_help
73
+ else
74
+ if i.start_with?('/') and i.end_with?('/')
75
+ # ================================================================= #
76
+ # Assume this to be a pseudo-regex.
77
+ # ================================================================= #
78
+ search_for_this_element = i.delete('/').capitalize
79
+ _ = ChemistryParadise.return_element_symbol_from_this_german_name(search_for_this_element)
80
+ if _
81
+ e simp(search_for_this_element)+' corresponds to '+sfancy(_)+'.'
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end; alias check_against_menu menu # === check_against_menu
87
+
88
+ end; end
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::ParseCommandline
6
+ #
7
+ # Use this class in order to parse the commandline.
8
+ # =========================================================================== #
9
+ # require 'chemistry_paradise/commandline/parse_commandline.rb'
10
+ # =========================================================================== #
11
+ require 'chemistry_paradise/base/base.rb'
12
+ require 'chemistry_paradise/commandline/menu.rb'
13
+ require 'chemistry_paradise/commandline/help.rb'
14
+
15
+ module ChemistryParadise
16
+
17
+ class ParseCommandline < ::ChemistryParadise::Base # === ChemistryParadise::ParseCommandline
18
+
19
+ # ========================================================================= #
20
+ # === initialize
21
+ # ========================================================================= #
22
+ def initialize(
23
+ optional_input = ARGV,
24
+ run_already = true
25
+ )
26
+ set_commandline(optional_input)
27
+ reset
28
+ run if run_already
29
+ end
30
+
31
+ # ========================================================================= #
32
+ # === reset
33
+ # ========================================================================= #
34
+ def reset
35
+ super()
36
+ end
37
+
38
+ # ========================================================================= #
39
+ # === show_the_periodic_table
40
+ # ========================================================================= #
41
+ def show_the_periodic_table
42
+ _ = ::ChemistryParadise.periodic_table?
43
+ if File.exist? _
44
+ YAML.load_file(_).each_pair {|key, value|
45
+ e ' '+(key.to_s+ ':').ljust(3)+' '+value.to_s.rjust(2)
46
+ }
47
+ end
48
+ end
49
+
50
+ # ========================================================================= #
51
+ # === set_commandline
52
+ # ========================================================================= #
53
+ def set_commandline(i)
54
+ i = [i] unless i.is_a? Array
55
+ @commandline = i
56
+ end
57
+
58
+ # ========================================================================= #
59
+ # === run
60
+ # ========================================================================= #
61
+ def run
62
+ menu
63
+ end
64
+
65
+ # ========================================================================= #
66
+ # === berechne_atomgewicht
67
+ # ========================================================================= #
68
+ def berechne_atomgewicht(i)
69
+ pp i
70
+ if i.is_a? Array
71
+ i.flatten.each {|entry|
72
+ berechne_atomgewicht(i)
73
+ }
74
+ else
75
+ if i == :test_default_molecules
76
+ i = ARRAY_TEST_THESE_MOLECULES
77
+ end
78
+ if i.is_a? Array
79
+ berechne_atomgewicht(i)
80
+ else
81
+ e sprintf(
82
+ 'The mass number of %-4s is %3s',
83
+ i,
84
+ ChemistryParadise::CalculateAtomicMass.new(i).result.to_s
85
+ )
86
+ end
87
+ end
88
+ end
89
+
90
+ end; end
91
+
92
+ if __FILE__ == $PROGRAM_NAME
93
+ ChemistryParadise::ParseCommandline.new(ARGV)
94
+ end
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'chemistry_paradise/constants/constants.rb'
6
+ # =========================================================================== #
7
+ require 'yaml'
8
+ require 'chemistry_paradise/constants/file_constants.rb'
9
+
10
+ module ChemistryParadise
11
+
12
+ module Constants # include ChemistryParadise::Constants
13
+
14
+ # ========================================================================= #
15
+ # === N
16
+ # ========================================================================= #
17
+ N = "\n"
18
+
19
+ # ========================================================================= #
20
+ # === ELECTRON_NEGATIVITY_CHART
21
+ # ========================================================================= #
22
+ if File.exist? FILE_ELECTRON_NEGATIVITY_CHART
23
+ ELECTRON_NEGATIVITY_CHART = YAML.load_file(FILE_ELECTRON_NEGATIVITY_CHART)
24
+ else
25
+ ELECTRON_NEGATIVITY_CHART = nil
26
+ end
27
+
28
+ # ========================================================================= #
29
+ # === electron_negativity_chart?
30
+ # ========================================================================= #
31
+ def electron_negativity_chart?
32
+ ELECTRON_NEGATIVITY_CHART
33
+ end
34
+
35
+ # ========================================================================= #
36
+ # === SPEED_OF_LIGHT
37
+ #
38
+ # The speed of light, in m / sec.
39
+ #
40
+ # You can refer to this constant in your ruby scripts too:
41
+ # c = ChemistryParadise::Constants::SPEED_OF_LIGHT
42
+ # ========================================================================= #
43
+ SPEED_OF_LIGHT = 299_792_458
44
+
45
+ # ========================================================================= #
46
+ # === PLANK_CONSTANT
47
+ #
48
+ # h = ChemistryParadise::Constants::PLANK_CONSTANT
49
+ # ========================================================================= #
50
+ PLANK_CONSTANT = 6.62607004 * (10 ** -34)
51
+
52
+ # ========================================================================= #
53
+ # === PROPER_FILLORDER
54
+ # ========================================================================= #
55
+ PROPER_FILLORDER = %w(
56
+ 1s
57
+ 2s
58
+ 2p
59
+ 3s
60
+ 3p
61
+ 4s
62
+ 3d
63
+ 4p
64
+ 5s
65
+ 4d
66
+ 5p
67
+ 6s
68
+ 4f
69
+ 5d
70
+ 6p
71
+ 7s
72
+ 5f
73
+ 6d
74
+ 7p
75
+ )
76
+
77
+ end; end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module ChemistryParadise
6
+
7
+ module ConstantsForChemicalFormulas # === ChemistryParadise::ConstantsForChemicalFormulas
8
+
9
+ # ========================================================================= #
10
+ # === R
11
+ #
12
+ # This is 8.314 J⋅K−1⋅mol−1.
13
+ # ========================================================================= #
14
+ R = 8.314
15
+
16
+ end; end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'chemistry_paradise/constants/file_constants.rb'
6
+ # =========================================================================== #
7
+ require 'chemistry_paradise/project/project.rb'
8
+
9
+ module ChemistryParadise
10
+
11
+ module Constants # === ChemistryParadise::Constants
12
+
13
+ # ========================================================================= #
14
+ # === FILE_ELECTRON_NEGATIVITY_CHART
15
+ #
16
+ # bl $RUBY_SRC/chemistry_paradise/lib/chemistry_paradise/yaml/electron_negativity_chart.yml
17
+ # ========================================================================= #
18
+ FILE_ELECTRON_NEGATIVITY_CHART =
19
+ "#{PROJECT_BASE_DIRECTORY}yaml/electron_negativity_chart.yml"
20
+
21
+ # ========================================================================= #
22
+ # === FILE_ATOMGEWICHTE
23
+ # ========================================================================= #
24
+ FILE_ATOMGEWICHTE =
25
+ "#{PROJECT_BASE_DIRECTORY}yaml/atomgewichte.yml"
26
+
27
+ # ========================================================================= #
28
+ # === ChemistryParadise::Constants::FILE_PERIODIC_TABLE_OF_THE_ELEMENTS
29
+ # ========================================================================= #
30
+ FILE_PERIODIC_TABLE_OF_THE_ELEMENTS =
31
+ "#{PROJECT_BASE_DIRECTORY}yaml/periodic_table_of_the_elements.yml"
32
+
33
+ end; end