Class: Chemicalml::Model::Atom
- 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
-
#count ⇒ Object
Returns the value of attribute count.
-
#element ⇒ Object
Returns the value of attribute element.
-
#formal_charge ⇒ Object
Returns the value of attribute formal_charge.
-
#hydrogen_count ⇒ Object
Returns the value of attribute hydrogen_count.
-
#id ⇒ Object
Returns the value of attribute id.
-
#isotope ⇒ Object
Returns the value of attribute isotope.
-
#lone_pairs ⇒ Object
Returns the value of attribute lone_pairs.
-
#radical_electrons ⇒ Object
Returns the value of attribute radical_electrons.
-
#spin_multiplicity ⇒ Object
Returns the value of attribute spin_multiplicity.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#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
constructor
A new instance of Atom.
- #value_attributes ⇒ Object
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
#count ⇒ Object
Returns the value of attribute count.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def count @count end |
#element ⇒ Object
Returns the value of attribute element.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def element @element end |
#formal_charge ⇒ Object
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_count ⇒ Object
Returns the value of attribute hydrogen_count.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def hydrogen_count @hydrogen_count end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def id @id end |
#isotope ⇒ Object
Returns the value of attribute isotope.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def isotope @isotope end |
#lone_pairs ⇒ Object
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_electrons ⇒ Object
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_multiplicity ⇒ Object
Returns the value of attribute spin_multiplicity.
10 11 12 |
# File 'lib/chemicalml/model/atom.rb', line 10 def spin_multiplicity @spin_multiplicity end |
#title ⇒ Object
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_attributes ⇒ Object
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 |