class

Chem::Atom

Inherits Comparable / Reference / Object

Constructors

new(residue : Residue, serial : Int32, element : Element, name : String, coords : Spatial::Vec3, typename : String | Nil = nil, formal_charge : Int32 = 0, mass : Float64 = element.mass, occupancy : Float64 = 1, partial_charge : Float64 = 0.0, temperature_factor : Float64 = 0, vdw_radius : Float64 = element.vdw_radius)
Source

Instance methods

<=>(other : self) : Int32

The comparison operator.

Returns -1, 0 or 1 depending on whether self precedes rhs, equals to rhs or comes after rhs. The comparison is done based on atom serial.

atoms = Structure.read(&quot;peptide.pdb&quot;).atoms

atoms[0] &lt;=&gt; atoms[1] # =&gt; -1
atoms[1] &lt;=&gt; atoms[1] # =&gt; 0
atoms[2] &lt;=&gt; atoms[1] # =&gt; 1
Source
===(atom_t : Templates::Atom) : Bool

Case equality. This is equivalent to #matches?.

structure = Structure.read &quot;peptide.pdb&quot;
desc = case structure.dig('A', 5, &quot;CA&quot;)
       when Templates::Atom(&quot;C&quot;)  then &quot;carbonyl carbon&quot;
       when Templates::Atom(&quot;CA&quot;) then &quot;alpha carbon&quot;
       when Templates::Atom(&quot;CB&quot;) then &quot;beta carbon&quot;
       when Templates::Atom(&quot;CG&quot;) then &quot;gamma carbon&quot;
       when Templates::Atom(&quot;CD&quot;) then &quot;delta carbon&quot;
       when PeriodicTable::C         then &quot;carbon&quot;
       else                               &quot;non-carbon&quot;
       end
desc # =&gt; &quot;alpha carbon&quot;
Source
===(element : Element) : Bool

Case equality. Returns true if atom's element is element, otherwise false.

structure = Structure.read &quot;peptide.pdb&quot;
desc = case structure.dig('A', 5, &quot;CK&quot;)
       when Templates::Atom(&quot;C&quot;)  then &quot;carbonyl carbon&quot;
       when Templates::Atom(&quot;CA&quot;) then &quot;alpha carbon&quot;
       when Templates::Atom(&quot;CB&quot;) then &quot;beta carbon&quot;
       when Templates::Atom(&quot;CG&quot;) then &quot;gamma carbon&quot;
       when Templates::Atom(&quot;CD&quot;) then &quot;delta carbon&quot;
       when PeriodicTable::C         then &quot;carbon&quot;
       else                               &quot;non-carbon&quot;
       end
desc # =&gt; &quot;non-carbon&quot;
Source
actinium?

Returns true if the atom's element is &quot;Actinium&quot;, else false.

Source
aluminum?

Returns true if the atom's element is &quot;Aluminum&quot;, else false.

Source
americium?

Returns true if the atom's element is &quot;Americium&quot;, else false.

Source
antimony?

Returns true if the atom's element is &quot;Antimony&quot;, else false.

Source
argon?

Returns true if the atom's element is &quot;Argon&quot;, else false.

Source
arsenic?

Returns true if the atom's element is &quot;Arsenic&quot;, else false.

Source
astatine?

Returns true if the atom's element is &quot;Astatine&quot;, else false.

Source
atomic_number(*args, **options)
Source
atomic_number(*args, **options, &)
Source
barium?

Returns true if the atom's element is &quot;Barium&quot;, else false.

Source
berkelium?

Returns true if the atom's element is &quot;Berkelium&quot;, else false.

Source
beryllium?

Returns true if the atom's element is &quot;Beryllium&quot;, else false.

Source
bismuth?

Returns true if the atom's element is &quot;Bismuth&quot;, else false.

Source
bohrium?

Returns true if the atom's element is &quot;Bohrium&quot;, else false.

Source
bonded?(to other : self) : Bool
Source
bonded_atoms
Source
bonds
Source
boron?

Returns true if the atom's element is &quot;Boron&quot;, else false.

Source
bromine?

Returns true if the atom's element is &quot;Bromine&quot;, else false.

Source
cadmium?

Returns true if the atom's element is &quot;Cadmium&quot;, else false.

Source
calcium?

Returns true if the atom's element is &quot;Calcium&quot;, else false.

Source
californium?

Returns true if the atom's element is &quot;Californium&quot;, else false.

Source
carbon?

Returns true if the atom's element is &quot;Carbon&quot;, else false.

Source
cerium?

Returns true if the atom's element is &quot;Cerium&quot;, else false.

Source
cesium?

Returns true if the atom's element is &quot;Cesium&quot;, else false.

Source
chain(*args, **options)
Source
chain(*args, **options, &)
Source
chlorine?

Returns true if the atom's element is &quot;Chlorine&quot;, else false.

Source
chromium?

Returns true if the atom's element is &quot;Chromium&quot;, else false.

Source
cobalt?

Returns true if the atom's element is &quot;Cobalt&quot;, else false.

Source
constraint
Source
constraint=(constraint : Constraint | Nil)
Source
coords
Source
coords=(coords : Spatial::Vec3)
Source
copernicium?

Returns true if the atom's element is &quot;Copernicium&quot;, else false.

Source
copper?

Returns true if the atom's element is &quot;Copper&quot;, else false.

Source
covalent_radius(*args, **options)
Source
covalent_radius(*args, **options, &)
Source
curium?

Returns true if the atom's element is &quot;Curium&quot;, else false.

Source
darmstadtium?

Returns true if the atom's element is &quot;Darmstadtium&quot;, else false.

Source
degree

Returns the number of bonds.

Source
dna?

Returns true if the atom belongs to a dna residue, else false.

Source
dubnium?

Returns true if the atom's element is &quot;Dubnium&quot;, else false.

Source
dysprosium?

Returns true if the atom's element is &quot;Dysprosium&quot;, else false.

Source
each_bonded_atom
Source
each_bonded_atom
Source
einsteinium?

Returns true if the atom's element is &quot;Einsteinium&quot;, else false.

Source
element
Source
element=(element : Element)
Source
erbium?

Returns true if the atom's element is &quot;Erbium&quot;, else false.

Source
europium?

Returns true if the atom's element is &quot;Europium&quot;, else false.

Source
fermium?

Returns true if the atom's element is &quot;Fermium&quot;, else false.

Source
flerovium?

Returns true if the atom's element is &quot;Flerovium&quot;, else false.

Source
fluorine?

Returns true if the atom's element is &quot;Fluorine&quot;, else false.

Source
formal_charge
Source
formal_charge=(formal_charge : Int32)
Source
francium?

Returns true if the atom's element is &quot;Francium&quot;, else false.

Source
gadolinium?

Returns true if the atom's element is &quot;Gadolinium&quot;, else false.

Source
gallium?

Returns true if the atom's element is &quot;Gallium&quot;, else false.

Source
germanium?

Returns true if the atom's element is &quot;Germanium&quot;, else false.

Source
gold?

Returns true if the atom's element is &quot;Gold&quot;, else false.

Source
hafnium?

Returns true if the atom's element is &quot;Hafnium&quot;, else false.

Source
hassium?

Returns true if the atom's element is &quot;Hassium&quot;, else false.

Source
heavy?(*args, **options)
Source
heavy?(*args, **options, &)
Source
helium?

Returns true if the atom's element is &quot;Helium&quot;, else false.

Source
het?

Returns true if the atom belongs to a non-standard (HET) residue, else false.

Source
holmium?

Returns true if the atom's element is &quot;Holmium&quot;, else false.

Source
hydrogen?

Returns true if the atom's element is &quot;Hydrogen&quot;, else false.

Source
indium?

Returns true if the atom's element is &quot;Indium&quot;, else false.

Source
iodine?

Returns true if the atom's element is &quot;Iodine&quot;, else false.

Source
ion?

Returns true if the atom belongs to a ion residue, else false.

Source
iridium?

Returns true if the atom's element is &quot;Iridium&quot;, else false.

Source
iron?

Returns true if the atom's element is &quot;Iron&quot;, else false.

Source
krypton?

Returns true if the atom's element is &quot;Krypton&quot;, else false.

Source
lanthanum?

Returns true if the atom's element is &quot;Lanthanum&quot;, else false.

Source
lawrencium?

Returns true if the atom's element is &quot;Lawrencium&quot;, else false.

Source
lead?

Returns true if the atom's element is &quot;Lead&quot;, else false.

Source
lithium?

Returns true if the atom's element is &quot;Lithium&quot;, else false.

Source
livermorium?

Returns true if the atom's element is &quot;Livermorium&quot;, else false.

Source
lutetium?

Returns true if the atom's element is &quot;Lutetium&quot;, else false.

Source
magnesium?

Returns true if the atom's element is &quot;Magnesium&quot;, else false.

Source
manganese?

Returns true if the atom's element is &quot;Manganese&quot;, else false.

Source
mass
Source
mass=(mass : Float64)
Source
matches?(atom_t : Templates::Atom) : Bool

Returns true if the atom matches the given template, else false.

Checking for a match considers both atom name and element.

atom = Structure.read(&quot;peptide.pdb&quot;).dig 'A', 1, &quot;CA&quot;
atom.match?(Templates::Atom.new(&quot;CA&quot;))               # =&gt; true
atom.match?(Templates::Atom.new(&quot;CA&quot;, element: &quot;N&quot;)) # =&gt; false
atom.match?(Templates::Atom.new(&quot;ND2&quot;))              # =&gt; false

TODO: compare topology via Templates::Atom#top_spec

Source
max_valence(*args, **options)
Source
max_valence(*args, **options, &)
Source
meitnerium?

Returns true if the atom's element is &quot;Meitnerium&quot;, else false.

Source
membrane?

Returns true if the atom belongs to a membrane residue, else false.

Source
mendelevium?

Returns true if the atom's element is &quot;Mendelevium&quot;, else false.

Source
mercury?

Returns true if the atom's element is &quot;Mercury&quot;, else false.

Source
metadata

Hash-like container that stores the atom's additional properties as key (string)-value pairs. A property's value can be any of the primitive types (string, integer, float, or bool), and so it's internally stored as Metadata::Any. Use the cast methods (#as_*) to convert to the desired type.

atom.metadata[&quot;foo&quot;] = 123
atom.metadata[&quot;foo&quot;]      # =&gt; Metadata::Any(123)
atom.metadata[&quot;foo&quot;].as_i # =&gt; 123
atom.metadata[&quot;foo&quot;].as_f # =&gt; 123.0
atom.metadata[&quot;foo&quot;].as_s # raises TypeCastError
Source
missing_valence
Source
molybdenum?

Returns true if the atom's element is &quot;Molybdenum&quot;, else false.

Source
moscovium?

Returns true if the atom's element is &quot;Moscovium&quot;, else false.

Source
name
Source
name=(name : String)
Source
neodymium?

Returns true if the atom's element is &quot;Neodymium&quot;, else false.

Source
neon?

Returns true if the atom's element is &quot;Neon&quot;, else false.

Source
neptunium?

Returns true if the atom's element is &quot;Neptunium&quot;, else false.

Source
nickel?

Returns true if the atom's element is &quot;Nickel&quot;, else false.

Source
nihonium?

Returns true if the atom's element is &quot;Nihonium&quot;, else false.

Source
niobium?

Returns true if the atom's element is &quot;Niobium&quot;, else false.

Source
nitrogen?

Returns true if the atom's element is &quot;Nitrogen&quot;, else false.

Source
nobelium?

Returns true if the atom's element is &quot;Nobelium&quot;, else false.

Source
occupancy
Source
occupancy=(occupancy : Float64)
Source
oganesson?

Returns true if the atom's element is &quot;Oganesson&quot;, else false.

Source
osmium?

Returns true if the atom's element is &quot;Osmium&quot;, else false.

Source
other?

Returns true if the atom belongs to a other residue, else false.

Source
oxygen?

Returns true if the atom's element is &quot;Oxygen&quot;, else false.

Source
palladium?

Returns true if the atom's element is &quot;Palladium&quot;, else false.

Source
partial_charge
Source
partial_charge=(partial_charge : Float64)
Source
phosphorus?

Returns true if the atom's element is &quot;Phosphorus&quot;, else false.

Source
platinum?

Returns true if the atom's element is &quot;Platinum&quot;, else false.

Source
plutonium?

Returns true if the atom's element is &quot;Plutonium&quot;, else false.

Source
polonium?

Returns true if the atom's element is &quot;Polonium&quot;, else false.

Source
potassium?

Returns true if the atom's element is &quot;Potassium&quot;, else false.

Source
praseodymium?

Returns true if the atom's element is &quot;Praseodymium&quot;, else false.

Source
proactinium?

Returns true if the atom's element is &quot;Proactinium&quot;, else false.

Source
promethium?

Returns true if the atom's element is &quot;Promethium&quot;, else false.

Source
protein?

Returns true if the atom belongs to a protein residue, else false.

Source
radium?

Returns true if the atom's element is &quot;Radium&quot;, else false.

Source
radon?

Returns true if the atom's element is &quot;Radon&quot;, else false.

Source
residue
Source
residue=(new_res : Residue) : Residue
Source
rhenium?

Returns true if the atom's element is &quot;Rhenium&quot;, else false.

Source
rhodium?

Returns true if the atom's element is &quot;Rhodium&quot;, else false.

Source
roentgenium?

Returns true if the atom's element is &quot;Roentgenium&quot;, else false.

Source
rubidium?

Returns true if the atom's element is &quot;Rubidium&quot;, else false.

Source
ruthenium?

Returns true if the atom's element is &quot;Ruthenium&quot;, else false.

Source
rutherfordium?

Returns true if the atom's element is &quot;Rutherfordium&quot;, else false.

Source
samarium?

Returns true if the atom's element is &quot;Samarium&quot;, else false.

Source
scandium?

Returns true if the atom's element is &quot;Scandium&quot;, else false.

Source
seaborgium?

Returns true if the atom's element is &quot;Seaborgium&quot;, else false.

Source
selenium?

Returns true if the atom's element is &quot;Selenium&quot;, else false.

Source
serial
Source
serial=(serial : Int32)
Source
silicon?

Returns true if the atom's element is &quot;Silicon&quot;, else false.

Source
silver?

Returns true if the atom's element is &quot;Silver&quot;, else false.

Source
sodium?

Returns true if the atom's element is &quot;Sodium&quot;, else false.

Source
solvent?

Returns true if the atom belongs to a solvent residue, else false.

Source
spec(io : IO) : Nil

Writes the atom specification to the given IO.

Atom specification is a short string representation encoding atom information including chain, residue, atom name, and atom number.

Source
spec

Returns the atom specification.

Atom specification is a short string representation encoding atom information including chain, residue, atom name, and atom number.

Source
strontium?

Returns true if the atom's element is &quot;Strontium&quot;, else false.

Source
sulfur?

Returns true if the atom's element is &quot;Sulfur&quot;, else false.

Source
tantalum?

Returns true if the atom's element is &quot;Tantalum&quot;, else false.

Source
target_valence

Returns the target valence based on the effective valence. This is useful for multi-valent elements (e.g., sulfur, phosphorus).

Source
technetium?

Returns true if the atom's element is &quot;Technetium&quot;, else false.

Source
tellurium?

Returns true if the atom's element is &quot;Tellurium&quot;, else false.

Source
temperature_factor
Source
temperature_factor=(temperature_factor : Float64)
Source
tennessine?

Returns true if the atom's element is &quot;Tennessine&quot;, else false.

Source
terbium?

Returns true if the atom's element is &quot;Terbium&quot;, else false.

Source
thallium?

Returns true if the atom's element is &quot;Thallium&quot;, else false.

Source
thorium?

Returns true if the atom's element is &quot;Thorium&quot;, else false.

Source
thulium?

Returns true if the atom's element is &quot;Thulium&quot;, else false.

Source
tin?

Returns true if the atom's element is &quot;Tin&quot;, else false.

Source
titanium?

Returns true if the atom's element is &quot;Titanium&quot;, else false.

Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new(&quot;John&quot;, 32).to_s # =&gt; #&lt;Person:0x10a199f20&gt;
Source
tungsten?

Returns true if the atom's element is &quot;Tungsten&quot;, else false.

Source
typename

Atom typename. Usually specifies the atomic parameter set assigned to this atom within a given force field.

Source
typename=(typename : String | Nil)

Atom typename. Usually specifies the atomic parameter set assigned to this atom within a given force field.

Source
uranium?

Returns true if the atom's element is &quot;Uranium&quot;, else false.

Source
valence

Returns the effective valence. This is equivalent to the sum of the bond orders.

Source
valence_electrons(*args, **options)
Source
valence_electrons(*args, **options, &)
Source
vanadium?

Returns true if the atom's element is &quot;Vanadium&quot;, else false.

Source
vdw_radius
Source
vdw_radius=(vdw_radius : Float64)
Source
water?

Returns true if the atom belongs to a water residue, else false.

Source
within_covalent_distance?(rhs : self) : Bool
Source
x(*args, **options)
Source
x(*args, **options, &)
Source
xenon?

Returns true if the atom's element is &quot;Xenon&quot;, else false.

Source
y(*args, **options)
Source
y(*args, **options, &)
Source
ytterbium?

Returns true if the atom's element is &quot;Ytterbium&quot;, else false.

Source
yttrium?

Returns true if the atom's element is &quot;Yttrium&quot;, else false.

Source
z(*args, **options)
Source
z(*args, **options, &)
Source
zinc?

Returns true if the atom's element is &quot;Zinc&quot;, else false.

Source
zirconium?

Returns true if the atom's element is &quot;Zirconium&quot;, else false.

Source