Class: Chemicalml::Model::Bond
- Defined in:
- lib/chemicalml/model/bond.rb
Overview
A bond between two atoms. Endpoint references are string IDs
matching Atom#id; the kind enum follows CML conventions.
Constant Summary collapse
- KINDS =
%i[single double triple quadruple aromatic wedge hash dative wavy].freeze
- CML_ORDER =
{ single: "S", double: "D", triple: "T", quadruple: "Q", aromatic: "A", wedge: "W", hash: "H", dative: "DG", wavy: "V" }.freeze
Instance Attribute Summary collapse
-
#atom_refs ⇒ Object
Returns the value of attribute atom_refs.
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
Returns the value of attribute kind.
Instance Method Summary collapse
- #cml_order ⇒ Object
-
#initialize(id: nil, atom_refs:, kind: :single) ⇒ Bond
constructor
A new instance of Bond.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #children, #hash, short_name
Constructor Details
#initialize(id: nil, atom_refs:, kind: :single) ⇒ Bond
Returns a new instance of Bond.
18 19 20 21 22 |
# File 'lib/chemicalml/model/bond.rb', line 18 def initialize(id: nil, atom_refs:, kind: :single) @id = id @atom_refs = atom_refs @kind = kind end |
Instance Attribute Details
#atom_refs ⇒ Object
Returns the value of attribute atom_refs.
16 17 18 |
# File 'lib/chemicalml/model/bond.rb', line 16 def atom_refs @atom_refs end |
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/chemicalml/model/bond.rb', line 16 def id @id end |
#kind ⇒ Object
Returns the value of attribute kind.
16 17 18 |
# File 'lib/chemicalml/model/bond.rb', line 16 def kind @kind end |
Instance Method Details
#cml_order ⇒ Object
28 29 30 |
# File 'lib/chemicalml/model/bond.rb', line 28 def cml_order CML_ORDER.fetch(kind, "S") end |
#value_attributes ⇒ Object
24 25 26 |
# File 'lib/chemicalml/model/bond.rb', line 24 def value_attributes { id: id, atom_refs: atom_refs, kind: kind } end |