class ChemistryParadise::Orbitals

Public Class Methods

new( upto_n = 10, run_already = true ) click to toggle source
#

initialize

#
# File lib/chemistry_paradise/orbitals.rb, line 19
def initialize(
    upto_n      = 10,
    run_already = true
  )
  reset
  set_upto(upto_n)
  run if run_already
end

Public Instance Methods

calculate_for_this_orbital(n) click to toggle source
#

calculate_for_this_orbital

#
# File lib/chemistry_paradise/orbitals.rb, line 57
def calculate_for_this_orbital(n)
  2 * (n ** 2)
end
reset() click to toggle source
#

reset

#
# File lib/chemistry_paradise/orbitals.rb, line 38
def reset
  set_upto
end
run() click to toggle source
#

run

#
# File lib/chemistry_paradise/orbitals.rb, line 45
def run
  1.upto(@upto).each {|entry|
    e '  '+entry.to_s.rjust(3)+' -> '+
      sfancy(
        calculate_for_this_orbital(entry).to_s.rjust(3)
      )+' Orbitals.'
  }
end
set_upto(i = 10) click to toggle source
#

set_upto

#
# File lib/chemistry_paradise/orbitals.rb, line 31
def set_upto(i = 10) # 10 is default.
  @upto = i
end