Class: Chemicalml::Model::Atom

Inherits:
Node
  • Object
show all
Defined in:
lib/chemicalml/model/atom.rb

Overview

A chemical atom. Carries every attribute CML's <atom> carries that's chemistry-relevant: element symbol, formal charge, isotope, count (multiplicity), hydrogen count, lone pairs, radical electrons, spin multiplicity.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #children, #hash, short_name

Constructor Details

#initialize(element:, id: nil, formal_charge: nil, isotope: nil, count: nil, hydrogen_count: nil, lone_pairs: nil, radical_electrons: nil, spin_multiplicity: nil, title: nil) ⇒ Atom

Returns a new instance of Atom.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/chemicalml/model/atom.rb', line 14

def initialize(element:, id: nil, formal_charge: nil,
               isotope: nil, count: nil, hydrogen_count: nil,
               lone_pairs: nil, radical_electrons: nil,
               spin_multiplicity: nil, title: nil)
  @element = element
  @id = id
  @formal_charge = formal_charge
  @isotope = isotope
  @count = count
  @hydrogen_count = hydrogen_count
  @lone_pairs = lone_pairs
  @radical_electrons = radical_electrons
  @spin_multiplicity = spin_multiplicity
  @title = title
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def count
  @count
end

#elementObject

Returns the value of attribute element.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def element
  @element
end

#formal_chargeObject

Returns the value of attribute formal_charge.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def formal_charge
  @formal_charge
end

#hydrogen_countObject

Returns the value of attribute hydrogen_count.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def hydrogen_count
  @hydrogen_count
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def id
  @id
end

#isotopeObject

Returns the value of attribute isotope.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def isotope
  @isotope
end

#lone_pairsObject

Returns the value of attribute lone_pairs.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def lone_pairs
  @lone_pairs
end

#radical_electronsObject

Returns the value of attribute radical_electrons.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def radical_electrons
  @radical_electrons
end

#spin_multiplicityObject

Returns the value of attribute spin_multiplicity.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def spin_multiplicity
  @spin_multiplicity
end

#titleObject

Returns the value of attribute title.



10
11
12
# File 'lib/chemicalml/model/atom.rb', line 10

def title
  @title
end

Instance Method Details

#value_attributesObject



30
31
32
33
34
35
36
37
# File 'lib/chemicalml/model/atom.rb', line 30

def value_attributes
  {
    element: element, id: id, formal_charge: formal_charge,
    isotope: isotope, count: count, hydrogen_count: hydrogen_count,
    lone_pairs: lone_pairs, radical_electrons: radical_electrons,
    spin_multiplicity: spin_multiplicity, title: title
  }
end