Class: Chemicalml::Model::Molecule
- Defined in:
- lib/chemicalml/model/molecule.rb
Overview
A molecule: ordered atom list + optional bond list + optional names and identifiers + optional count (multiplicity in a larger context).
Instance Attribute Summary collapse
-
#atoms ⇒ Object
Returns the value of attribute atoms.
-
#bonds ⇒ Object
Returns the value of attribute bonds.
-
#count ⇒ Object
Returns the value of attribute count.
-
#formal_charge ⇒ Object
Returns the value of attribute formal_charge.
-
#id ⇒ Object
Returns the value of attribute id.
-
#identifiers ⇒ Object
Returns the value of attribute identifiers.
-
#names ⇒ Object
Returns the value of attribute names.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(id: nil, atoms: [], bonds: [], names: [], identifiers: [], count: nil, formal_charge: nil, title: nil) ⇒ Molecule
constructor
A new instance of Molecule.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #hash, short_name
Constructor Details
#initialize(id: nil, atoms: [], bonds: [], names: [], identifiers: [], count: nil, formal_charge: nil, title: nil) ⇒ Molecule
Returns a new instance of Molecule.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/chemicalml/model/molecule.rb', line 12 def initialize(id: nil, atoms: [], bonds: [], names: [], identifiers: [], count: nil, formal_charge: nil, title: nil) @id = id @atoms = atoms @bonds = bonds @names = names @identifiers = identifiers @count = count @formal_charge = formal_charge @title = title end |
Instance Attribute Details
#atoms ⇒ Object
Returns the value of attribute atoms.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def atoms @atoms end |
#bonds ⇒ Object
Returns the value of attribute bonds.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def bonds @bonds end |
#count ⇒ Object
Returns the value of attribute count.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def count @count end |
#formal_charge ⇒ Object
Returns the value of attribute formal_charge.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def formal_charge @formal_charge end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def id @id end |
#identifiers ⇒ Object
Returns the value of attribute identifiers.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def identifiers @identifiers end |
#names ⇒ Object
Returns the value of attribute names.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def names @names end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/chemicalml/model/molecule.rb', line 9 def title @title end |
Instance Method Details
#children ⇒ Object
25 26 27 |
# File 'lib/chemicalml/model/molecule.rb', line 25 def children atoms + bonds + names + identifiers end |
#value_attributes ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/chemicalml/model/molecule.rb', line 29 def value_attributes { id: id, atoms: atoms, bonds: bonds, names: names, identifiers: identifiers, count: count, formal_charge: formal_charge, title: title } end |