Class: Chemicalml::Model::Molecule

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

Overview

A molecule: ordered atom list + optional bond list + optional names, identifiers, formulas, properties, labels + optional count (multiplicity in a larger context).

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #hash, short_name

Constructor Details

#initialize(id: nil, atoms: [], bonds: [], names: [], identifiers: [], formulas: [], properties: [], labels: [], count: nil, formal_charge: nil, title: nil) ⇒ Molecule

Returns a new instance of Molecule.



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

def initialize(id: nil, atoms: [], bonds: [], names: [],
               identifiers: [], formulas: [], properties: [],
               labels: [], count: nil, formal_charge: nil,
               title: nil)
  @id = id
  @atoms = atoms
  @bonds = bonds
  @names = names
  @identifiers = identifiers
  @formulas = formulas
  @properties = properties
  @labels = labels
  @count = count
  @formal_charge = formal_charge
  @title = title
end

Instance Attribute Details

#atomsObject

Returns the value of attribute atoms.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def atoms
  @atoms
end

#bondsObject

Returns the value of attribute bonds.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def bonds
  @bonds
end

#countObject

Returns the value of attribute count.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def count
  @count
end

#formal_chargeObject

Returns the value of attribute formal_charge.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def formal_charge
  @formal_charge
end

#formulasObject

Returns the value of attribute formulas.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def formulas
  @formulas
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def id
  @id
end

#identifiersObject

Returns the value of attribute identifiers.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def identifiers
  @identifiers
end

#labelsObject

Returns the value of attribute labels.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def labels
  @labels
end

#namesObject

Returns the value of attribute names.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def names
  @names
end

#propertiesObject

Returns the value of attribute properties.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def properties
  @properties
end

#titleObject

Returns the value of attribute title.



9
10
11
# File 'lib/chemicalml/model/molecule.rb', line 9

def title
  @title
end

Instance Method Details

#childrenObject



30
31
32
33
# File 'lib/chemicalml/model/molecule.rb', line 30

def children
  atoms + bonds + names + identifiers +
    formulas + properties + labels
end

#value_attributesObject



35
36
37
38
39
40
41
42
# File 'lib/chemicalml/model/molecule.rb', line 35

def value_attributes
  {
    id: id, atoms: atoms, bonds: bonds, names: names,
    identifiers: identifiers, formulas: formulas,
    properties: properties, labels: labels,
    count: count, formal_charge: formal_charge, title: title
  }
end