Class: Chem::G98::MolecularOrbital

Inherits:
Object
  • Object
show all
Defined in:
lib/chem/db/g98.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, sym, occupy_or_virtual) ⇒ MolecularOrbital

Returns a new instance of MolecularOrbital.



564
565
566
567
568
569
# File 'lib/chem/db/g98.rb', line 564

def initialize index, sym, occupy_or_virtual
  @index = index
  @sym = sym
  @occupy_or_virtual = occupy_or_virtual
  @coefficient = Hash.new
end

Instance Attribute Details

#eigen_valueObject

Returns the value of attribute eigen_value.



563
564
565
# File 'lib/chem/db/g98.rb', line 563

def eigen_value
  @eigen_value
end

#indexObject

Returns the value of attribute index.



563
564
565
# File 'lib/chem/db/g98.rb', line 563

def index
  @index
end

Instance Method Details

#each_aoObject



570
571
572
573
574
# File 'lib/chem/db/g98.rb', line 570

def each_ao
  @coefficient.each do |key, ao|
    yield key, ao
  end
end

#push(ao, coef) ⇒ Object



575
576
577
578
# File 'lib/chem/db/g98.rb', line 575

def push ao, coef
  @coefficient[ao] = coef
  #    puts index.to_s + ' : ' + @sym.to_s + ':' + ' : ' + @occupy_or_virtual + ':' + ao + ' : ' +coef.to_s + ' '
end

#to_sObject

puts index.to_s + ‘ : ’ + @sym.to_s + ‘:’ + ‘ : ’ + @occupy_or_virtual + ‘:’ + ao + ‘ : ’ coef.to_s ‘ ’



579
580
581
582
583
584
585
586
587
588
# File 'lib/chem/db/g98.rb', line 579

def to_s
  s = sprintf(" %3d %s %s", @index, @sym, @occupy_or_virtual)
  if @coefficient.length < 1
    puts '@coefficient == 0!'
  end
  @coefficient.each do |key, coef|
    s = s + sprintf(" %1.1f", coef)
  end
  s
end