Module: Chem::Atom
- Included in:
- GSpanAtom, MDL::MDLAtom, MDL::RxnAtom, SkeletonAtom, SmilesAtom, Sybyl::SybylAtom, TINKER::TinkerAtom, XYZ::XyzAtom
- Defined in:
- lib/chem/model.rb,
lib/chem/db/mdl.rb,
lib/chem/db/sybyl.rb,
lib/chem/db/vector.rb,
lib/chem/utils/prop.rb
Overview
Atom module is top level abstract module for atom in molecule. It will be mixed-in to other concrete class.
Constant Summary collapse
- MDLAtomLineFormat =
"%10.4f%10.4f%10.4f %2s%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d"
Instance Attribute Summary collapse
-
#charge ⇒ Object
charge.
-
#color ⇒ Object
[r, g, b].
-
#element ⇒ Object
atomic symbol (Symbol object).
-
#mass ⇒ Object
Returns atomic mass.
-
#v_pos ⇒ Object
position vector for visualization.
-
#visible ⇒ Object
true if visible (for visualization).
-
#x ⇒ Object
x-axis position.
-
#y ⇒ Object
y-axis position.
-
#z ⇒ Object
z-axis position.
Instance Method Summary collapse
-
#atomic_number ⇒ Object
Returns Atomic Number.
-
#electro_negativity ⇒ Object
Returns electro negativity see chem/data/electronegativity.rb.
-
#natural_bond_order ⇒ Object
Returns Natural Bond Order of this atom :C => 4, :H => 1…
- #to_mdl(mapping = 0) ⇒ Object
- #to_sybyl ⇒ Object
-
#weight ⇒ Object
Returns Atomic weight see chem/data/atomic_weight.rb.
Instance Attribute Details
#charge ⇒ Object
charge
34 35 36 |
# File 'lib/chem/model.rb', line 34 def charge @charge end |
#color ⇒ Object
- r, g, b
19 20 21 |
# File 'lib/chem/model.rb', line 19 def color @color end |
#element ⇒ Object
atomic symbol (Symbol object)
22 23 24 |
# File 'lib/chem/model.rb', line 22 def element @element end |
#mass ⇒ Object
Returns atomic mass
37 38 39 |
# File 'lib/chem/model.rb', line 37 def mass @mass end |
#v_pos ⇒ Object
position vector for visualization
20 21 22 |
# File 'lib/chem/db/vector.rb', line 20 def v_pos @v_pos end |
#visible ⇒ Object
true if visible (for visualization)
17 18 19 |
# File 'lib/chem/model.rb', line 17 def visible @visible end |
#x ⇒ Object
x-axis position
25 26 27 |
# File 'lib/chem/model.rb', line 25 def x @x end |
#y ⇒ Object
y-axis position
28 29 30 |
# File 'lib/chem/model.rb', line 28 def y @y end |
#z ⇒ Object
z-axis position
31 32 33 |
# File 'lib/chem/model.rb', line 31 def z @z end |
Instance Method Details
#atomic_number ⇒ Object
Returns Atomic Number. If unknown return 100.
41 42 43 |
# File 'lib/chem/model.rb', line 41 def atomic_number Number2Element.index(element) ? Number2Element.index(element) : 100 end |
#electro_negativity ⇒ Object
Returns electro negativity see chem/data/electronegativity.rb
11 12 13 |
# File 'lib/chem/utils/prop.rb', line 11 def electro_negativity ElectroNegativity[self.element] end |
#natural_bond_order ⇒ Object
Returns Natural Bond Order of this atom :C => 4, :H => 1… see chem/data/character.rb
18 19 20 |
# File 'lib/chem/utils/prop.rb', line 18 def natural_bond_order NaturalBondOrder[self.element] end |
#to_mdl(mapping = 0) ⇒ Object
33 34 35 |
# File 'lib/chem/db/mdl.rb', line 33 def to_mdl mapping = 0 MDLAtomLineFormat % [x, y, z, element, 0, 0, 0, 0, 0, 0, 0, 0, 0, mapping, 0, 0] end |
#to_sybyl ⇒ Object
14 15 16 17 |
# File 'lib/chem/db/sybyl.rb', line 14 def to_sybyl " 1 C1 -3.262565 -0.588014 -0.082185 C.3 1 <1> -0.020001 " "%7d" % [1] end |
#weight ⇒ Object
Returns Atomic weight see chem/data/atomic_weight.rb
24 25 26 |
# File 'lib/chem/utils/prop.rb', line 24 def weight AtomicWeight[self.element] end |