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, 2D/3D coordinates,
fractional coordinates. Optional atom_parity for atom-centre
chirality.
Instance Attribute Summary collapse
-
#atom_parity ⇒ Object
Returns the value of attribute atom_parity.
-
#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.
-
#x2 ⇒ Object
Returns the value of attribute x2.
-
#x3 ⇒ Object
Returns the value of attribute x3.
-
#x_fract ⇒ Object
Returns the value of attribute x_fract.
-
#y2 ⇒ Object
Returns the value of attribute y2.
-
#y3 ⇒ Object
Returns the value of attribute y3.
-
#y_fract ⇒ Object
Returns the value of attribute y_fract.
-
#z3 ⇒ Object
Returns the value of attribute z3.
-
#z_fract ⇒ Object
Returns the value of attribute z_fract.
Instance Method Summary collapse
- #children ⇒ Object
-
#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, x2: nil, y2: nil, x3: nil, y3: nil, z3: nil, x_fract: nil, y_fract: nil, z_fract: nil, atom_parity: nil) ⇒ Atom
constructor
A new instance of Atom.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #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, x2: nil, y2: nil, x3: nil, y3: nil, z3: nil, x_fract: nil, y_fract: nil, z_fract: nil, atom_parity: nil) ⇒ Atom
Returns a new instance of Atom.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/chemicalml/model/atom.rb', line 19 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, x2: nil, y2: nil, x3: nil, y3: nil, z3: nil, x_fract: nil, y_fract: nil, z_fract: nil, atom_parity: 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 @x2 = x2 @y2 = y2 @x3 = x3 @y3 = y3 @z3 = z3 @x_fract = x_fract @y_fract = y_fract @z_fract = z_fract @atom_parity = atom_parity end |
Instance Attribute Details
#atom_parity ⇒ Object
Returns the value of attribute atom_parity.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def atom_parity @atom_parity end |
#count ⇒ Object
Returns the value of attribute count.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def count @count end |
#element ⇒ Object
Returns the value of attribute element.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def element @element end |
#formal_charge ⇒ Object
Returns the value of attribute formal_charge.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def formal_charge @formal_charge end |
#hydrogen_count ⇒ Object
Returns the value of attribute hydrogen_count.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def hydrogen_count @hydrogen_count end |
#id ⇒ Object
Returns the value of attribute id.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def id @id end |
#isotope ⇒ Object
Returns the value of attribute isotope.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def isotope @isotope end |
#lone_pairs ⇒ Object
Returns the value of attribute lone_pairs.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def lone_pairs @lone_pairs end |
#radical_electrons ⇒ Object
Returns the value of attribute radical_electrons.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def radical_electrons @radical_electrons end |
#spin_multiplicity ⇒ Object
Returns the value of attribute spin_multiplicity.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def spin_multiplicity @spin_multiplicity end |
#title ⇒ Object
Returns the value of attribute title.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def title @title end |
#x2 ⇒ Object
Returns the value of attribute x2.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def x2 @x2 end |
#x3 ⇒ Object
Returns the value of attribute x3.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def x3 @x3 end |
#x_fract ⇒ Object
Returns the value of attribute x_fract.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def x_fract @x_fract end |
#y2 ⇒ Object
Returns the value of attribute y2.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def y2 @y2 end |
#y3 ⇒ Object
Returns the value of attribute y3.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def y3 @y3 end |
#y_fract ⇒ Object
Returns the value of attribute y_fract.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def y_fract @y_fract end |
#z3 ⇒ Object
Returns the value of attribute z3.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def z3 @z3 end |
#z_fract ⇒ Object
Returns the value of attribute z_fract.
12 13 14 |
# File 'lib/chemicalml/model/atom.rb', line 12 def z_fract @z_fract end |
Instance Method Details
#children ⇒ Object
47 48 49 |
# File 'lib/chemicalml/model/atom.rb', line 47 def children [atom_parity].compact end |
#value_attributes ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/chemicalml/model/atom.rb', line 51 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, x2: x2, y2: y2, x3: x3, y3: y3, z3: z3, x_fract: x_fract, y_fract: y_fract, z_fract: z_fract, atom_parity: atom_parity } end |