Class: Chem::G98::G98Atom
- Inherits:
-
Object
- Object
- Chem::G98::G98Atom
- Defined in:
- lib/chem/db/g98.rb
Constant Summary collapse
- VALENCY =
{'C'=>4, 'N'=>3, 'H'=>1, 'F'=>1, 'CL'=>1, 'I'=>1, 'O'=>2, 'BR'=>1}
- VALENCY2 =
{'C'=>2, 'H'=>-1, 'O'=>0, 'F'=>-1, 'CL'=>-1, 'BR'=>-1}
- WEIGHT =
{'O'=>15.9999, 'BR'=>79.904, 'H'=>1.00794, 'C'=>12.001, 'F'=>18.9984032, 'CL'=>35.4527, 'N'=>14.00674}
Instance Attribute Summary collapse
-
#angle(atom, angle) ⇒ Object
include Atom.
-
#angle_atom ⇒ Object
include Atom.
-
#density ⇒ Object
include Atom.
-
#dihedral_angle_atom ⇒ Object
include Atom.
-
#dihedral_angle_b ⇒ Object
include Atom.
-
#diheral_angle_a ⇒ Object
include Atom.
-
#distance_atom ⇒ Object
include Atom.
-
#distance_length ⇒ Object
include Atom.
-
#element ⇒ Object
include Atom.
-
#heavy_charge ⇒ Object
include Atom.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#total_atomic_charge ⇒ Object
include Atom.
-
#x ⇒ Object
include Atom.
-
#y ⇒ Object
include Atom.
-
#z ⇒ Object
include Atom.
Instance Method Summary collapse
- #ao(hash) ⇒ Object
- #dihedral(atom, angle_a, angle_b) ⇒ Object
- #distance(atom, length) ⇒ Object
- #each_ao ⇒ Object
- #get_distance(atom) ⇒ Object
-
#initialize(index, molecule) ⇒ G98Atom
constructor
A new instance of G98Atom.
- #neighbor?(atom, length) ⇒ Boolean
- #to_cartessian_coodinate ⇒ Object
- #to_condensed_density ⇒ Object
- #to_mol ⇒ Object
- #to_s ⇒ Object
- #to_xyz ⇒ Object
- #to_z_matrix ⇒ Object
- #valency ⇒ Object
- #valency2 ⇒ Object
- #weight ⇒ Object
Constructor Details
#initialize(index, molecule) ⇒ G98Atom
Returns a new instance of G98Atom.
619 620 621 622 623 624 |
# File 'lib/chem/db/g98.rb', line 619 def initialize index, molecule @index = index @molecule = molecule @density = Hash.new @orbital = Hash.new end |
Instance Attribute Details
#angle(atom, angle) ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def angle @angle end |
#angle_atom ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def angle_atom @angle_atom end |
#density ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def density @density end |
#dihedral_angle_atom ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def dihedral_angle_atom @dihedral_angle_atom end |
#dihedral_angle_b ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def dihedral_angle_b @dihedral_angle_b end |
#diheral_angle_a ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def diheral_angle_a @diheral_angle_a end |
#distance_atom ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def distance_atom @distance_atom end |
#distance_length ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def distance_length @distance_length end |
#element ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def element @element end |
#heavy_charge ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def heavy_charge @heavy_charge end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
615 616 617 |
# File 'lib/chem/db/g98.rb', line 615 def index @index end |
#total_atomic_charge ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def total_atomic_charge @total_atomic_charge end |
#x ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def x @x end |
#y ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def y @y end |
#z ⇒ Object
include Atom
612 613 614 |
# File 'lib/chem/db/g98.rb', line 612 def z @z end |
Instance Method Details
#ao(hash) ⇒ Object
651 652 653 654 655 656 657 |
# File 'lib/chem/db/g98.rb', line 651 def ao hash if @orbital[hash] == nil return @orbital[hash] = AtomicOrbital.new(hash) else return @orbital[hash] end end |
#dihedral(atom, angle_a, angle_b) ⇒ Object
666 667 668 669 670 |
# File 'lib/chem/db/g98.rb', line 666 def dihedral atom, angle_a, angle_b @dihedral_atom = atom @dihedral_angle_a = angle_a @dihedral_angle_b = angle_b end |
#distance(atom, length) ⇒ Object
658 659 660 661 |
# File 'lib/chem/db/g98.rb', line 658 def distance atom, length @distance_atom = atom @distance_length = length end |
#each_ao ⇒ Object
646 647 648 649 650 |
# File 'lib/chem/db/g98.rb', line 646 def each_ao @orbital.each_value do |atomic_orbital| yield atomic_orbital end end |
#get_distance(atom) ⇒ Object
625 626 627 |
# File 'lib/chem/db/g98.rb', line 625 def get_distance atom Math.sqrt((@x - atom.x)*(@x - atom.x) + (@y - atom.y)*(@y - atom.y) + (@z - atom.z)*(@z - atom.z)) end |
#neighbor?(atom, length) ⇒ Boolean
628 629 630 |
# File 'lib/chem/db/g98.rb', line 628 def neighbor? atom, length return (get_distance(atom) < length) end |
#to_cartessian_coodinate ⇒ Object
685 686 687 |
# File 'lib/chem/db/g98.rb', line 685 def to_cartessian_coodinate sprintf(" %2s % f % f % f", @element, @x, @y, @z) end |
#to_condensed_density ⇒ Object
678 679 680 681 682 683 684 |
# File 'lib/chem/db/g98.rb', line 678 def to_condensed_density s = sprintf("%2s ", @element) 1.upto @molecule.atoms.length do |num| s = s + sprintf("% f ", @density[num].to_s) end return s end |
#to_mol ⇒ Object
688 689 690 |
# File 'lib/chem/db/g98.rb', line 688 def to_mol sprintf("%10.4f%10.4f%10.4f %-2s 0 0 0 0 0", @x, @y, @z, @element) end |
#to_s ⇒ Object
671 672 673 674 675 676 677 |
# File 'lib/chem/db/g98.rb', line 671 def to_s if @molecule.has_cartessian_coordinate return to_cartessian_coodinate elsif @molecule.has_z_matrix return to_z_matrix end end |
#to_xyz ⇒ Object
691 692 693 |
# File 'lib/chem/db/g98.rb', line 691 def to_xyz sprintf("%2s% 8.3f% 8.3f% 8.3f\n", @element, @x, @y, @z) end |
#to_z_matrix ⇒ Object
694 695 696 697 698 699 700 701 702 703 704 705 706 |
# File 'lib/chem/db/g98.rb', line 694 def to_z_matrix s = sprintf("%d %s ", @molecule.atoms.index(self), @element) if @distance_atom != nil s = s + sprintf("%2d %f ", @molecule.atoms.index(@distance_atom), @distance_length) end if @angle_atom != nil s = s + sprintf("%2d %f ", @molecule.atoms.index(@angle_atom), @angle) end if @dihedral_atom != nil s = s + sprintf("%2d %f %f", @molecule.atoms.index(@dihedral_atom), @dihedral_angle_a, @dihedral_angle_b) end return s end |
#valency ⇒ Object
638 639 640 641 |
# File 'lib/chem/db/g98.rb', line 638 def valency puts('@element : ' + @element + 'is not defined valency!!') if VALENCY[@element] == nil VALENCY[@element] end |