eulim 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/.gitignore +12 -12
- data/.rspec +2 -2
- data/.travis.yml +5 -5
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +4 -4
- data/LICENSE +21 -21
- data/LICENSE.txt +21 -21
- data/README.md +71 -71
- data/Rakefile +6 -6
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/eulim.gemspec +43 -43
- data/lib/eulim.rb +8 -8
- data/lib/eulim/chemistry.rb +6 -6
- data/lib/eulim/chemistry/compound.rb +59 -59
- data/lib/eulim/chemistry/element.rb +53 -265
- data/lib/eulim/chemistry/elements.csv +110 -0
- data/lib/eulim/chemistry/reaction.rb +73 -0
- data/lib/eulim/structures.rb +6 -6
- data/lib/eulim/structures/pipe.rb +13 -13
- data/lib/eulim/structures/structure.rb +12 -12
- data/lib/eulim/version.rb +3 -3
- metadata +5 -3
@@ -0,0 +1,110 @@
|
|
1
|
+
symbol,name,atomic_number,atomic_weight
|
2
|
+
H,Hydrogen,1,1.0079
|
3
|
+
He,Helium,2,4.002602
|
4
|
+
Li,Lithium,3,6.941
|
5
|
+
Be,Beryllium,4,9.012182
|
6
|
+
B,Boron,5,10.811
|
7
|
+
C,Carbon,6,12.0107
|
8
|
+
N,Nitrogen,7,14.0067
|
9
|
+
O,Oxygen,8,15.9996
|
10
|
+
F,Fluorine,9,18.9984
|
11
|
+
Ne,Neon,10,20.1797
|
12
|
+
Na,Sodium,11,22.9897
|
13
|
+
Mg,Magnesium,12,24.305
|
14
|
+
Al,Aluminium,13,26.9815
|
15
|
+
Si,Silicon,14,28.0855
|
16
|
+
P,Phosphorus,15,30.9738
|
17
|
+
S,Sulfur,16,32.065
|
18
|
+
Cl,Chlorine,17,35.453
|
19
|
+
Ar,Argon,18,39.948
|
20
|
+
K,Potassium,19,39.0983
|
21
|
+
Ca,Calcium,20,40.078
|
22
|
+
Sc,Scandium,21,44.9559
|
23
|
+
Ti,Titanium,22,47.867
|
24
|
+
V,Vanadium,23,50.9415
|
25
|
+
Cr,Chromium,24,51.9961
|
26
|
+
Mn,Manganese,25,54.938
|
27
|
+
Fe,Iron,26,55.845
|
28
|
+
Co,Cobalt,27,58.9332
|
29
|
+
Ni,Nickel,28,58.6934
|
30
|
+
Cu,Copper,29,63.546
|
31
|
+
Zn,Zinc,30,65.39
|
32
|
+
Ga,Gallium,31,69.723
|
33
|
+
Ge,Germanium,32,72.64
|
34
|
+
As,Arsenic,33,74.9216
|
35
|
+
Se,Selenium,34,78.96
|
36
|
+
Br,Bromine,35,79.904
|
37
|
+
Kr,Krypton,36,83.3
|
38
|
+
Rb,Rubidium,37,85.4678
|
39
|
+
Sr,Strontium,38,87.62
|
40
|
+
Y,Yttrium,39,88.9059
|
41
|
+
Zr,Zirconium,40,91.224
|
42
|
+
Nb,Niobium,41,92.9064
|
43
|
+
Mo,Molybdenum,42,95.94
|
44
|
+
Tc,Technitium,43,98
|
45
|
+
Ru,Ruthenium,44,101.07
|
46
|
+
Rh,Rhodium,45,102.9055
|
47
|
+
Pd,Palladium,46,106.42
|
48
|
+
Ag,Silver,47,107.8682
|
49
|
+
Cd,Cadmiuim,48,112.411
|
50
|
+
In,Indium,49,114.818
|
51
|
+
Sn,Tin,50,118.71
|
52
|
+
Sb,Antimony,51,121.76
|
53
|
+
Te,Tellurium,52,127.6
|
54
|
+
I,Iodine,53,126.9045
|
55
|
+
Xe,Xenon,54,131.293
|
56
|
+
Cs,Cesium,55,132.9055
|
57
|
+
Ba,Barium,56,137.327
|
58
|
+
La,Lanthanum,57,138.9055
|
59
|
+
Ce,Cerium,58,140.116
|
60
|
+
Pr,Praseodymium,59,140.9077
|
61
|
+
Nd,Neodymium,60,144.24
|
62
|
+
Pm,Promethium,61,145
|
63
|
+
Sm,Samarium,62,150.36
|
64
|
+
Eu,Europium,63,151.964
|
65
|
+
Gd,Gadolium,64,157.25
|
66
|
+
Tb,Terbium,65,158.9253
|
67
|
+
Dy,Dysprosium,66,162.5
|
68
|
+
Ho,Holmium,67,164.9303
|
69
|
+
Er,Erbium,68,167.259
|
70
|
+
Tm,Thulium,69,168.9342
|
71
|
+
Yb,Ytterbium,70,173.04
|
72
|
+
Lu,Lutetium,71,174.967
|
73
|
+
Hf,Hafnium,72,178.49
|
74
|
+
Ta,Tantalum,73,180.9479
|
75
|
+
W,Tungsten,74,183.84
|
76
|
+
Re,Rhenium,75,186.207
|
77
|
+
Os,Osmium,76,190.23
|
78
|
+
Ir,Iridium,77,192.217
|
79
|
+
Pt,Platinum,78,195.078
|
80
|
+
Au,Gold,79,196.9665
|
81
|
+
Hg,Mercury,80,200.59
|
82
|
+
Tl,Thallium,81,204.3833
|
83
|
+
Pb,Lead,82,207.2
|
84
|
+
Bi,Bismuth,83,208.9804
|
85
|
+
Po,Polonium,84,209
|
86
|
+
At,Astatine,85,210
|
87
|
+
Rn,Radon,86,222
|
88
|
+
Fr,Francium,87,223
|
89
|
+
Ra,Radium,88,226
|
90
|
+
Ac,Actinium,89,227
|
91
|
+
Th,Thorium,90,232.0381
|
92
|
+
Pa,Protactinium,91,231.0359
|
93
|
+
U,Uranium,92,238.0289
|
94
|
+
Np,Neptunum,93,237
|
95
|
+
Pu,Plutonium,94,244
|
96
|
+
Am,Americium,95,243
|
97
|
+
Cm,Curium,96,247
|
98
|
+
Bk,Berkilium,97,247
|
99
|
+
Cf,Californium,98,251
|
100
|
+
Es,Einsteinium,99,252
|
101
|
+
Fm,Fermium,100,257
|
102
|
+
Md,Mendelevium,101,258
|
103
|
+
No,Nobelium,102,259
|
104
|
+
Lr,Lawrencium,103,262
|
105
|
+
Rf,Rutherfordium,104,261
|
106
|
+
Db,Dubnium,105,262
|
107
|
+
Sg,Seaborgium,106,266
|
108
|
+
Bh,Bohrium,107,264
|
109
|
+
Hs,Hassium,108,277
|
110
|
+
Mt,Meitnerium,109,268
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Eulim
|
2
|
+
module Chemistry
|
3
|
+
# This class has functionality for reaction
|
4
|
+
# Ex: check for balanced rxn, validity of a rxn
|
5
|
+
class Reaction
|
6
|
+
attr_accessor :equation, :is_valid, :is_balanced, :species
|
7
|
+
def initialize(arg)
|
8
|
+
@equation = arg
|
9
|
+
@species = build_species
|
10
|
+
@is_valid = valid_rxn?
|
11
|
+
@is_balanced = balanced_rxn?
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def build_species
|
17
|
+
r = {}
|
18
|
+
result = {}
|
19
|
+
r[:reactants], r[:products] = @equation.split('>>')
|
20
|
+
r.each do |type, _type_species|
|
21
|
+
result[type] = {}
|
22
|
+
r[type].split('+').each do |specie|
|
23
|
+
result[type].merge!(get_specie_info(specie))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_specie_info(specie)
|
30
|
+
specie = specie.strip
|
31
|
+
sc = get_stoichiometry specie
|
32
|
+
offset = sc.zero? ? 0 : sc.to_s.length
|
33
|
+
specie_str = specie[offset..specie.length]
|
34
|
+
{
|
35
|
+
specie_str => {
|
36
|
+
compound: Compound.new(specie_str),
|
37
|
+
stoichiometry: sc.zero? ? 1 : sc
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def balanced_rxn?
|
43
|
+
bal = { reactants: {}, products: {} }
|
44
|
+
@species.each do |type, type_species|
|
45
|
+
type_species.each do |_specie, s_info|
|
46
|
+
s_info[:compound].constituents.each do |sym, c_info|
|
47
|
+
bal[type][sym] ||= 0
|
48
|
+
bal[type][sym] += c_info[:atom_count] * s_info[:stoichiometry]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
bal[:products] == bal[:reactants]
|
53
|
+
end
|
54
|
+
|
55
|
+
def valid_rxn?
|
56
|
+
valid = {}
|
57
|
+
@species.each do |type, type_species|
|
58
|
+
valid[type] = []
|
59
|
+
type_species.each do |_specie, info|
|
60
|
+
info[:compound].constituents.each do |symbol, _count|
|
61
|
+
valid[type] << symbol
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
valid[:reactants].sort.uniq == valid[:products].sort.uniq
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_stoichiometry(specie)
|
69
|
+
specie.match(/^\d*/).to_a.first.to_i
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/eulim/structures.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
module Eulim
|
2
|
-
# This module will contain all physical structures
|
3
|
-
# Ex: pipes, sheets, walls, bridges, etc
|
4
|
-
module Structures
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Eulim
|
2
|
+
# This module will contain all physical structures
|
3
|
+
# Ex: pipes, sheets, walls, bridges, etc
|
4
|
+
module Structures
|
5
|
+
end
|
6
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module Eulim
|
2
|
-
module Structures
|
3
|
-
# This is the class for Pipe
|
4
|
-
# It inherits from Structure
|
5
|
-
class Pipe < Structure
|
6
|
-
def initialize(*args) end
|
7
|
-
|
8
|
-
def self.requirements
|
9
|
-
'gimme radius, length, thickness, material...'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
module Eulim
|
2
|
+
module Structures
|
3
|
+
# This is the class for Pipe
|
4
|
+
# It inherits from Structure
|
5
|
+
class Pipe < Structure
|
6
|
+
def initialize(*args) end
|
7
|
+
|
8
|
+
def self.requirements
|
9
|
+
'gimme radius, length, thickness, material...'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module Eulim
|
2
|
-
module Structures
|
3
|
-
# This is the base class for all structures
|
4
|
-
class Structure
|
5
|
-
def initialize(*args) end
|
6
|
-
|
7
|
-
def self.requirements
|
8
|
-
'gimme some stuff.'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
1
|
+
module Eulim
|
2
|
+
module Structures
|
3
|
+
# This is the base class for all structures
|
4
|
+
class Structure
|
5
|
+
def initialize(*args) end
|
6
|
+
|
7
|
+
def self.requirements
|
8
|
+
'gimme some stuff.'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/eulim/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Eulim
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
1
|
+
module Eulim
|
2
|
+
VERSION = '0.0.10'.freeze
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eulim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Syed Fazil Basheer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,8 @@ files:
|
|
103
103
|
- lib/eulim/chemistry.rb
|
104
104
|
- lib/eulim/chemistry/compound.rb
|
105
105
|
- lib/eulim/chemistry/element.rb
|
106
|
+
- lib/eulim/chemistry/elements.csv
|
107
|
+
- lib/eulim/chemistry/reaction.rb
|
106
108
|
- lib/eulim/structures.rb
|
107
109
|
- lib/eulim/structures/pipe.rb
|
108
110
|
- lib/eulim/structures/structure.rb
|
@@ -127,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
129
|
version: '0'
|
128
130
|
requirements: []
|
129
131
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.6.11
|
131
133
|
signing_key:
|
132
134
|
specification_version: 4
|
133
135
|
summary: A gem for scientific data.
|