Module: Chem::Atom

Includes:
Transform::ThreeDimension
Included in:
CDK::CDKAtom, CMLAtom, GSpanAtom, MDL::MDLAtom, MDL::RxnAtom, OpenBabel::OBAtom, SkeletonAtom, SmilesAtom, Sybyl::SybylAtom, TINKER::TinkerAtom, XYZ::XyzAtom, Record::HETATM
Defined in:
lib/chem/model.rb,
lib/chem.rb,
lib/chem/db/mdl.rb,
lib/chem/db/sybyl.rb,
lib/chem/db/vector.rb,
lib/chem/utils/cdk.rb,
lib/chem/utils/prop.rb,
lib/chem/utils/openbabel.rb,
lib/chem/utils/fingerprint.rb

Overview

CDK module

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

Methods included from Transform::TwoDimension

#pos

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/chem.rb', line 137

def method_missing(m, *args)
  if not @ob_atom.nil? and @ob_atom.respond_to?(m)
    @ob_atom.__send__(m, *args)
  else
    super(m, *args)
  end
end

Instance Attribute Details

#cdk_atomObject

Returns the value of attribute cdk_atom.



104
105
106
# File 'lib/chem/utils/cdk.rb', line 104

def cdk_atom
  @cdk_atom
end

#chargeObject

charge



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

def charge
  @charge
end

#colorObject

r, g, b


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

def color
  @color
end

#elementObject

atomic symbol (Symbol object)



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

def element
  @element
end

#labelObject

supplimentary information



29
30
31
# File 'lib/chem/db/vector.rb', line 29

def label
  @label
end

#massObject

Returns atomic mass



40
41
42
# File 'lib/chem/model.rb', line 40

def mass
  @mass
end

#ob_atomObject

Returns the value of attribute ob_atom.



9
10
11
# File 'lib/chem/utils/openbabel.rb', line 9

def ob_atom
  @ob_atom
end

#ringsObject

Returns the value of attribute rings.



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

def rings
  @rings
end

#v_posObject

position vector for visualization



27
28
29
# File 'lib/chem/db/vector.rb', line 27

def v_pos
  @v_pos
end

#visibleObject

true if visible (for visualization)



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

def visible
  @visible
end

#xObject

x-axis position



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

def x
  @x
end

#yObject

y-axis position



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

def y
  @y
end

#zObject

z-axis position



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

def z
  @z
end

Instance Method Details

#atomic_numberObject

Returns Atomic Number. If unknown return 100.



44
45
46
# File 'lib/chem/model.rb', line 44

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



45
46
47
48
49
50
# File 'lib/chem/db/mdl.rb', line 45

def to_mdl(mapping = 0)
  self.x ||= 0
  self.y ||= 0
  self.z ||= 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