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

Instance Method Summary collapse

Instance Attribute Details

#chargeObject

charge



34
35
36
# File 'lib/chem/model.rb', line 34

def charge
  @charge
end

#colorObject

r, g, b


19
20
21
# File 'lib/chem/model.rb', line 19

def color
  @color
end

#elementObject

atomic symbol (Symbol object)



22
23
24
# File 'lib/chem/model.rb', line 22

def element
  @element
end

#massObject

Returns atomic mass



37
38
39
# File 'lib/chem/model.rb', line 37

def mass
  @mass
end

#v_posObject

position vector for visualization



20
21
22
# File 'lib/chem/db/vector.rb', line 20

def v_pos
  @v_pos
end

#visibleObject

true if visible (for visualization)



17
18
19
# File 'lib/chem/model.rb', line 17

def visible
  @visible
end

#xObject

x-axis position



25
26
27
# File 'lib/chem/model.rb', line 25

def x
  @x
end

#yObject

y-axis position



28
29
30
# File 'lib/chem/model.rb', line 28

def y
  @y
end

#zObject

z-axis position



31
32
33
# File 'lib/chem/model.rb', line 31

def z
  @z
end

Instance Method Details

#atomic_numberObject

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_negativityObject

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_orderObject

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_sybylObject



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

#weightObject

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