Jump to content

Eulim

From Wikipedia, the free encyclopedia
Eulim
Original author(s)Syed Fazil Basheer
Developer(s)Syed Fazil Basheer, Somesh Choudhary
Initial releaseApril 11, 2017; 7 years ago (2017-04-11)
Stable release
0.0.17 / July 15, 2017; 7 years ago (2017-07-15)[1]
Repositorygithub.com/ilm-labs/ilm
Written inRuby
LicenseMIT License

Eulim or ilm is a chemistry library written in Ruby under the MIT license. It supports the calculation of molecular mass of compound, balancing chemical equations, efficient handling of states of chemical species and many more things.

Example

[edit]
$ irb
irb(main):001:0> require 'eulim'
irb(main):002:0> Eulim::Chemistry::Reaction.new(equation: 'KMnO4   HCl >> KCl   MnCl2   H2O   Cl2').balanced_eqn
 => "2KMnO4   16HCl >> 2KCl   2MnCl2   8H2O   5Cl2"
 
irb(main):003:0> Eulim::Chemistry::Compound.new("CaCO3")
=> #<Eulim::Chemistry::Compound:0x00000002a65340 @formula="CaCO3", @constituents={"Ca"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c805a8 @name="Calcium", @symbol="Ca", @atomic_number=20, @atomic_mass=#<Unitwise::Measurement value=40.078 unit=u>>, :atom_count=>1}, "C"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c8f6e8 @name="Carbon", @symbol="C", @atomic_number=6, @atomic_mass=#<Unitwise::Measurement value=12.0107 unit=u>>, :atom_count=>1}, "O"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c8dc30 @name="Oxygen", @symbol="O", @atomic_number=8, @atomic_mass=#<Unitwise::Measurement value=15.9996 unit=u>>, :atom_count=>3}}, @molecular_mass=#<Unitwise::Measurement value=100.0875 unit=u>>

irb(main):004:0> Eulim::Chemistry::Reaction.new(equation: '2Na(s)   2HCl(aq) >> 2NaCl(aq)   H2(g)')
=> #<Eulim::Chemistry::Reaction:0x00000002ce22f8 @equation="2Na(s)   2HCl(aq) >> 2NaCl(aq)   H2(g)", @species={:reactants=>{"Na"=>{:compound=>#<Eulim::Chemistry::Compound:0x00000002ce1d80 @formula="Na", @constituents={"Na"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c88e10 @name="Sodium", @symbol="Na", @atomic_number=11, @atomic_mass=#<Unitwise::Measurement value=22.9897 unit=u>>, :atom_count=>1}}, @molecular_mass=#<Unitwise::Measurement value=22.9897 unit=u>>, :stoichiometry=>2, :state=>"solid"}, "HCl"=>{:compound=>#<Eulim::Chemistry::Compound:0x00000002cabdc0 @formula="HCl", @constituents={"H"=>{:element=>#<Eulim::Chemistry::Element:0x000000025e5ab8 @name="Hydrogen", @symbol="H", @atomic_number=1, @atomic_mass=#<Unitwise::Measurement value=1.0079 unit=u>>, :atom_count=>1}, "Cl"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c82c90 @name="Chlorine", @symbol="Cl", @atomic_number=17, @atomic_mass=#<Unitwise::Measurement value=35.453 unit=u>>, :atom_count=>1}}, @molecular_mass=#<Unitwise::Measurement value=36.4609 unit=u>>, :stoichiometry=>2, :state=>"aqueous"}}, :products=>{"NaCl"=>{:compound=>#<Eulim::Chemistry::Compound:0x00000002c8cda8 @formula="NaCl", @constituents={"Na"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c88e10 @name="Sodium", @symbol="Na", @atomic_number=11, @atomic_mass=#<Unitwise::Measurement value=22.9897 unit=u>>, :atom_count=>1}, "Cl"=>{:element=>#<Eulim::Chemistry::Element:0x00000002c82c90 @name="Chlorine", @symbol="Cl", @atomic_number=17, @atomic_mass=#<Unitwise::Measurement value=35.453 unit=u>>, :atom_count=>1}}, @molecular_mass=#<Unitwise::Measurement value=58.4427 unit=u>>, :stoichiometry=>2, :state=>"aqueous"},"H2"=>{:compound=>#<Eulim::Chemistry::Compound:0x00000002c6f938 @formula="H2", @constituents={"H"=>{:element=>#<Eulim::Chemistry::Element:0x000000025e5ab8 @name="Hydrogen", @symbol="H", @atomic_number=1, @atomic_mass=#<Unitwise::Measurement value=1.0079 unit=u>>, :atom_count=>2}}, @molecular_mass=#<Unitwise::Measurement value=2.0158 unit=u>>, :stoichiometry=>1, :state=>"gaseous"}}}, @is_valid=true, @is_balanced=true>
[edit]

References

[edit]
  1. ^ "Releases". Github. Retrieved 1 September 2019.
  1. "eulim | RubyGems.org | your community gem host". rubygems.org. Retrieved 2017-07-11.
  2. "GitHub - syedfazilbasheer-quester/eulim-gem". github.com. Retrieved 2017-07-11.