class Chem::Atom
- Chem::Atom
- Reference
- Object
Included Modules
- Comparable(Chem::Atom)
Defined in:
chem/core/atom.crConstructors
Instance Method Summary
-
#<=>(other : self) : Int32
The comparison operator.
-
#===(atom_t : Templates::Atom) : Bool
Case equality.
-
#===(element : Element) : Bool
Case equality.
-
#actinium?
Returns
true
if the atom's element is "Actinium", elsefalse
. -
#aluminum?
Returns
true
if the atom's element is "Aluminum", elsefalse
. -
#americium?
Returns
true
if the atom's element is "Americium", elsefalse
. -
#antimony?
Returns
true
if the atom's element is "Antimony", elsefalse
. -
#argon?
Returns
true
if the atom's element is "Argon", elsefalse
. -
#arsenic?
Returns
true
if the atom's element is "Arsenic", elsefalse
. -
#astatine?
Returns
true
if the atom's element is "Astatine", elsefalse
. - #atomic_number(*args, **options)
- #atomic_number(*args, **options, &)
-
#barium?
Returns
true
if the atom's element is "Barium", elsefalse
. -
#berkelium?
Returns
true
if the atom's element is "Berkelium", elsefalse
. -
#beryllium?
Returns
true
if the atom's element is "Beryllium", elsefalse
. -
#bismuth?
Returns
true
if the atom's element is "Bismuth", elsefalse
. -
#bohrium?
Returns
true
if the atom's element is "Bohrium", elsefalse
. - #bonded?(to other : self) : Bool
- #bonded_atoms : Array(Atom)
- #bonds : BondArray
-
#boron?
Returns
true
if the atom's element is "Boron", elsefalse
. -
#bromine?
Returns
true
if the atom's element is "Bromine", elsefalse
. -
#cadmium?
Returns
true
if the atom's element is "Cadmium", elsefalse
. -
#calcium?
Returns
true
if the atom's element is "Calcium", elsefalse
. -
#californium?
Returns
true
if the atom's element is "Californium", elsefalse
. -
#carbon?
Returns
true
if the atom's element is "Carbon", elsefalse
. -
#cerium?
Returns
true
if the atom's element is "Cerium", elsefalse
. -
#cesium?
Returns
true
if the atom's element is "Cesium", elsefalse
. - #chain(*args, **options)
- #chain(*args, **options, &)
-
#chlorine?
Returns
true
if the atom's element is "Chlorine", elsefalse
. -
#chromium?
Returns
true
if the atom's element is "Chromium", elsefalse
. -
#cobalt?
Returns
true
if the atom's element is "Cobalt", elsefalse
. - #constraint : Constraint | Nil
- #constraint=(constraint : Constraint | Nil)
- #coords : Spatial::Vec3
- #coords=(coords : Spatial::Vec3)
-
#copernicium?
Returns
true
if the atom's element is "Copernicium", elsefalse
. -
#copper?
Returns
true
if the atom's element is "Copper", elsefalse
. - #covalent_radius(*args, **options)
- #covalent_radius(*args, **options, &)
-
#curium?
Returns
true
if the atom's element is "Curium", elsefalse
. -
#darmstadtium?
Returns
true
if the atom's element is "Darmstadtium", elsefalse
. -
#degree : Int32
Returns the number of bonds.
-
#dna? : Bool
Returns
true
if the atom belongs to a dna residue, elsefalse
. -
#dubnium?
Returns
true
if the atom's element is "Dubnium", elsefalse
. -
#dysprosium?
Returns
true
if the atom's element is "Dysprosium", elsefalse
. - #each_bonded_atom : Iterator(Atom)
- #each_bonded_atom(& : self -> ) : Nil
-
#einsteinium?
Returns
true
if the atom's element is "Einsteinium", elsefalse
. - #element : Element
- #element=(element : Element)
-
#erbium?
Returns
true
if the atom's element is "Erbium", elsefalse
. -
#europium?
Returns
true
if the atom's element is "Europium", elsefalse
. -
#fermium?
Returns
true
if the atom's element is "Fermium", elsefalse
. -
#flerovium?
Returns
true
if the atom's element is "Flerovium", elsefalse
. -
#fluorine?
Returns
true
if the atom's element is "Fluorine", elsefalse
. - #formal_charge : Int32
- #formal_charge=(formal_charge : Int32)
-
#francium?
Returns
true
if the atom's element is "Francium", elsefalse
. -
#gadolinium?
Returns
true
if the atom's element is "Gadolinium", elsefalse
. -
#gallium?
Returns
true
if the atom's element is "Gallium", elsefalse
. -
#germanium?
Returns
true
if the atom's element is "Germanium", elsefalse
. -
#gold?
Returns
true
if the atom's element is "Gold", elsefalse
. -
#hafnium?
Returns
true
if the atom's element is "Hafnium", elsefalse
. -
#hassium?
Returns
true
if the atom's element is "Hassium", elsefalse
. - #heavy?(*args, **options)
- #heavy?(*args, **options, &)
-
#helium?
Returns
true
if the atom's element is "Helium", elsefalse
. -
#het? : Bool
Returns
true
if the atom belongs to a non-standard (HET) residue, elsefalse
. -
#holmium?
Returns
true
if the atom's element is "Holmium", elsefalse
. -
#hydrogen?
Returns
true
if the atom's element is "Hydrogen", elsefalse
. -
#indium?
Returns
true
if the atom's element is "Indium", elsefalse
. -
#iodine?
Returns
true
if the atom's element is "Iodine", elsefalse
. -
#ion? : Bool
Returns
true
if the atom belongs to a ion residue, elsefalse
. -
#iridium?
Returns
true
if the atom's element is "Iridium", elsefalse
. -
#iron?
Returns
true
if the atom's element is "Iron", elsefalse
. -
#krypton?
Returns
true
if the atom's element is "Krypton", elsefalse
. -
#lanthanum?
Returns
true
if the atom's element is "Lanthanum", elsefalse
. -
#lawrencium?
Returns
true
if the atom's element is "Lawrencium", elsefalse
. -
#lead?
Returns
true
if the atom's element is "Lead", elsefalse
. -
#lithium?
Returns
true
if the atom's element is "Lithium", elsefalse
. -
#livermorium?
Returns
true
if the atom's element is "Livermorium", elsefalse
. -
#lutetium?
Returns
true
if the atom's element is "Lutetium", elsefalse
. -
#magnesium?
Returns
true
if the atom's element is "Magnesium", elsefalse
. -
#manganese?
Returns
true
if the atom's element is "Manganese", elsefalse
. - #mass : Float64
- #mass=(mass : Float64)
-
#matches?(atom_t : Templates::Atom) : Bool
Returns
true
if the atom matches the given template, elsefalse
. - #max_valence(*args, **options)
- #max_valence(*args, **options, &)
-
#meitnerium?
Returns
true
if the atom's element is "Meitnerium", elsefalse
. -
#membrane? : Bool
Returns
true
if the atom belongs to a membrane residue, elsefalse
. -
#mendelevium?
Returns
true
if the atom's element is "Mendelevium", elsefalse
. -
#mercury?
Returns
true
if the atom's element is "Mercury", elsefalse
. -
#metadata : Metadata
Hash-like container that stores the atom's additional properties as key (string)-value pairs.
- #missing_valence : Int32
-
#molybdenum?
Returns
true
if the atom's element is "Molybdenum", elsefalse
. -
#moscovium?
Returns
true
if the atom's element is "Moscovium", elsefalse
. - #name : String
- #name=(name : String)
-
#neodymium?
Returns
true
if the atom's element is "Neodymium", elsefalse
. -
#neon?
Returns
true
if the atom's element is "Neon", elsefalse
. -
#neptunium?
Returns
true
if the atom's element is "Neptunium", elsefalse
. -
#nickel?
Returns
true
if the atom's element is "Nickel", elsefalse
. -
#nihonium?
Returns
true
if the atom's element is "Nihonium", elsefalse
. -
#niobium?
Returns
true
if the atom's element is "Niobium", elsefalse
. -
#nitrogen?
Returns
true
if the atom's element is "Nitrogen", elsefalse
. -
#nobelium?
Returns
true
if the atom's element is "Nobelium", elsefalse
. - #occupancy : Float64
- #occupancy=(occupancy : Float64)
-
#oganesson?
Returns
true
if the atom's element is "Oganesson", elsefalse
. -
#osmium?
Returns
true
if the atom's element is "Osmium", elsefalse
. -
#other? : Bool
Returns
true
if the atom belongs to a other residue, elsefalse
. -
#oxygen?
Returns
true
if the atom's element is "Oxygen", elsefalse
. -
#palladium?
Returns
true
if the atom's element is "Palladium", elsefalse
. - #partial_charge : Float64
- #partial_charge=(partial_charge : Float64)
-
#phosphorus?
Returns
true
if the atom's element is "Phosphorus", elsefalse
. -
#platinum?
Returns
true
if the atom's element is "Platinum", elsefalse
. -
#plutonium?
Returns
true
if the atom's element is "Plutonium", elsefalse
. -
#polonium?
Returns
true
if the atom's element is "Polonium", elsefalse
. -
#potassium?
Returns
true
if the atom's element is "Potassium", elsefalse
. -
#praseodymium?
Returns
true
if the atom's element is "Praseodymium", elsefalse
. -
#proactinium?
Returns
true
if the atom's element is "Proactinium", elsefalse
. -
#promethium?
Returns
true
if the atom's element is "Promethium", elsefalse
. -
#protein? : Bool
Returns
true
if the atom belongs to a protein residue, elsefalse
. -
#radium?
Returns
true
if the atom's element is "Radium", elsefalse
. -
#radon?
Returns
true
if the atom's element is "Radon", elsefalse
. - #residue : Residue
- #residue=(new_res : Residue) : Residue
-
#rhenium?
Returns
true
if the atom's element is "Rhenium", elsefalse
. -
#rhodium?
Returns
true
if the atom's element is "Rhodium", elsefalse
. -
#roentgenium?
Returns
true
if the atom's element is "Roentgenium", elsefalse
. -
#rubidium?
Returns
true
if the atom's element is "Rubidium", elsefalse
. -
#ruthenium?
Returns
true
if the atom's element is "Ruthenium", elsefalse
. -
#rutherfordium?
Returns
true
if the atom's element is "Rutherfordium", elsefalse
. -
#samarium?
Returns
true
if the atom's element is "Samarium", elsefalse
. -
#scandium?
Returns
true
if the atom's element is "Scandium", elsefalse
. -
#seaborgium?
Returns
true
if the atom's element is "Seaborgium", elsefalse
. -
#selenium?
Returns
true
if the atom's element is "Selenium", elsefalse
. - #serial : Int32
- #serial=(serial : Int32)
-
#silicon?
Returns
true
if the atom's element is "Silicon", elsefalse
. -
#silver?
Returns
true
if the atom's element is "Silver", elsefalse
. -
#sodium?
Returns
true
if the atom's element is "Sodium", elsefalse
. -
#solvent? : Bool
Returns
true
if the atom belongs to a solvent residue, elsefalse
. -
#spec(io : IO) : Nil
Writes the atom specification to the given IO.
-
#spec : String
Returns the atom specification.
-
#strontium?
Returns
true
if the atom's element is "Strontium", elsefalse
. -
#sulfur?
Returns
true
if the atom's element is "Sulfur", elsefalse
. -
#tantalum?
Returns
true
if the atom's element is "Tantalum", elsefalse
. -
#target_valence : Int32
Returns the target valence based on the effective valence.
-
#technetium?
Returns
true
if the atom's element is "Technetium", elsefalse
. -
#tellurium?
Returns
true
if the atom's element is "Tellurium", elsefalse
. - #temperature_factor : Float64
- #temperature_factor=(temperature_factor : Float64)
-
#tennessine?
Returns
true
if the atom's element is "Tennessine", elsefalse
. -
#terbium?
Returns
true
if the atom's element is "Terbium", elsefalse
. -
#thallium?
Returns
true
if the atom's element is "Thallium", elsefalse
. -
#thorium?
Returns
true
if the atom's element is "Thorium", elsefalse
. -
#thulium?
Returns
true
if the atom's element is "Thulium", elsefalse
. -
#tin?
Returns
true
if the atom's element is "Tin", elsefalse
. -
#titanium?
Returns
true
if the atom's element is "Titanium", elsefalse
. -
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
-
#tungsten?
Returns
true
if the atom's element is "Tungsten", elsefalse
. -
#typename : String | Nil
Atom typename.
-
#typename=(typename : String | Nil)
Atom typename.
-
#uranium?
Returns
true
if the atom's element is "Uranium", elsefalse
. -
#valence : Int32
Returns the effective valence.
- #valence_electrons(*args, **options)
- #valence_electrons(*args, **options, &)
-
#vanadium?
Returns
true
if the atom's element is "Vanadium", elsefalse
. - #vdw_radius : Float64
- #vdw_radius=(vdw_radius : Float64)
-
#water? : Bool
Returns
true
if the atom belongs to a water residue, elsefalse
. - #within_covalent_distance?(rhs : self) : Bool
- #x(*args, **options)
- #x(*args, **options, &)
-
#xenon?
Returns
true
if the atom's element is "Xenon", elsefalse
. - #y(*args, **options)
- #y(*args, **options, &)
-
#ytterbium?
Returns
true
if the atom's element is "Ytterbium", elsefalse
. -
#yttrium?
Returns
true
if the atom's element is "Yttrium", elsefalse
. - #z(*args, **options)
- #z(*args, **options, &)
-
#zinc?
Returns
true
if the atom's element is "Zinc", elsefalse
. -
#zirconium?
Returns
true
if the atom's element is "Zirconium", elsefalse
.
Constructor Detail
Instance Method Detail
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("peptide.pdb").atoms
atoms[0] <=> atoms[1] # => -1
atoms[1] <=> atoms[1] # => 0
atoms[2] <=> atoms[1] # => 1
Case equality. This is equivalent to #matches?
.
structure = Structure.read "peptide.pdb"
desc = case structure.dig('A', 5, "CA")
when Templates::Atom("C") then "carbonyl carbon"
when Templates::Atom("CA") then "alpha carbon"
when Templates::Atom("CB") then "beta carbon"
when Templates::Atom("CG") then "gamma carbon"
when Templates::Atom("CD") then "delta carbon"
when PeriodicTable::C then "carbon"
else "non-carbon"
end
desc # => "alpha carbon"
Case equality. Returns true if atom's element is element, otherwise false.
structure = Structure.read "peptide.pdb"
desc = case structure.dig('A', 5, "CK")
when Templates::Atom("C") then "carbonyl carbon"
when Templates::Atom("CA") then "alpha carbon"
when Templates::Atom("CB") then "beta carbon"
when Templates::Atom("CG") then "gamma carbon"
when Templates::Atom("CD") then "delta carbon"
when PeriodicTable::C then "carbon"
else "non-carbon"
end
desc # => "non-carbon"
Returns true
if the atom matches the given template, else
false
.
Checking for a match considers both atom name and element.
atom = Structure.read("peptide.pdb").dig 'A', 1, "CA"
atom.match?(Templates::Atom.new("CA")) # => true
atom.match?(Templates::Atom.new("CA", element: "N")) # => false
atom.match?(Templates::Atom.new("ND2")) # => false
TODO compare topology via Templates::Atom#top_spec
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["foo"] = 123
atom.metadata["foo"] # => Metadata::Any(123)
atom.metadata["foo"].as_i # => 123
atom.metadata["foo"].as_f # => 123.0
atom.metadata["foo"].as_s # raises TypeCastError
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.
Returns the atom specification.
Atom specification is a short string representation encoding atom information including chain, residue, atom name, and atom number.
Returns the target valence based on the effective valence. This is useful for multi-valent elements (e.g., sulfur, phosphorus).
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("John", 32).to_s # => #<Person:0x10a199f20>
Atom typename. Usually specifies the atomic parameter set assigned to this atom within a given force field.
Atom typename. Usually specifies the atomic parameter set assigned to this atom within a given force field.
Returns the effective valence. This is equivalent to the sum of the bond orders.