class Chem::Atom

Overview

TODO rename charge to #formal_charge

TODO add partial_charge : Float64 = 0.0

TODO add residue_index that starts from 0 and does not reset per chain

Defined in:

chem/core/atom.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, serial : Int32, coords : Spatial::Vector, residue : Residue, element : Element | Nil = nil, formal_charge : Int32 = 0, mass : Number | Nil = nil, occupancy : Float64 = 1, partial_charge : Float64 = 0.0, temperature_factor : Float64 = 0, vdw_radius : Number | Nil = nil) #

[View source]

Instance Method Detail

def <=>(rhs : 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("peptide.pdb").atoms

atoms[0] <=> atoms[1] # => -1
atoms[1] <=> atoms[1] # => 0
atoms[2] <=> atoms[1] # => 1

[View source]
def ===(element : Element) : Bool #

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 Topology::AtomType("C")  then "carbonyl carbon"
       when Topology::AtomType("CA") then "alpha carbon"
       when Topology::AtomType("CB") then "beta carbon"
       when Topology::AtomType("CG") then "gamma carbon"
       when Topology::AtomType("CD") then "delta carbon"
       when PeriodicTable::C         then "carbon"
       else                               "non-carbon"
       end
desc # => "non-carbon"

[View source]
def ===(atom_t : Topology::AtomType) : Bool #

Case equality. This is equivalent to #match?.

structure = Structure.read "peptide.pdb"
desc = case structure.dig('A', 5, "CA")
       when Topology::AtomType("C")  then "carbonyl carbon"
       when Topology::AtomType("CA") then "alpha carbon"
       when Topology::AtomType("CB") then "beta carbon"
       when Topology::AtomType("CG") then "gamma carbon"
       when Topology::AtomType("CD") then "delta carbon"
       when PeriodicTable::C         then "carbon"
       else                               "non-carbon"
       end
desc # => "alpha carbon"

[View source]
def atomic_number(*args, **options) #

[View source]
def atomic_number(*args, **options, &) #

[View source]
def bonded?(to other : self) : Bool #

[View source]
def bonded_atoms : Array(Atom) #

[View source]
def bonds : BondArray #

[View source]
def chain(*args, **options) #

[View source]
def chain(*args, **options, &) #

[View source]
def constraint : Constraint | Nil #

[View source]
def constraint=(constraint : Constraint | Nil) #

[View source]
def coords : Spatial::Vector #

[View source]
def coords=(coords : Spatial::Vector) #

[View source]
def covalent_radius(*args, **options) #

[View source]
def covalent_radius(*args, **options, &) #

[View source]
def each_bonded_atom : Iterator(Atom) #

[View source]
def each_bonded_atom(& : self -> ) : Nil #

[View source]
def element : Element #

[View source]
def element=(element : Element) #

[View source]
def formal_charge : Int32 #

[View source]
def formal_charge=(formal_charge : Int32) #

[View source]
def inspect(io : ::IO) #

[View source]
def mass : Float64 #

[View source]
def mass=(mass : Float64) #

[View source]
def match?(atom_t : Topology::AtomType) : Bool #

Matches self against atom_t.

Checking for a match considers both atom name and element.

atom = Structure.read("peptide.pdb").dig 'A', 1, "CA"
atom.match?(Topology::AtomType.new("CA"))               # => true
atom.match?(Topology::AtomType.new("CA", element: "N")) # => false
atom.match?(Topology::AtomType.new("ND2"))              # => false

[View source]
def max_valency(*args, **options) #

[View source]
def max_valency(*args, **options, &) #

[View source]
def missing_valency : Int32 #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def nominal_valency : Int32 #

[View source]
def occupancy : Float64 #

[View source]
def occupancy=(occupancy : Float64) #

[View source]
def partial_charge : Float64 #

[View source]
def partial_charge=(partial_charge : Float64) #

[View source]
def residue : Residue #

[View source]
def residue=(new_res : Residue) : Residue #

[View source]
def serial : Int32 #

[View source]
def serial=(serial : Int32) #

[View source]
def temperature_factor : Float64 #

[View source]
def temperature_factor=(temperature_factor : Float64) #

[View source]
def to_s(io : ::IO) #

[View source]
def valency : Int32 #

[View source]
def vdw_radius : Float64 #

[View source]
def vdw_radius=(vdw_radius : Float64) #

[View source]
def within_covalent_distance?(rhs : self) : Bool #

[View source]
def x(*args, **options) #

[View source]
def x(*args, **options, &) #

[View source]
def y(*args, **options) #

[View source]
def y(*args, **options, &) #

[View source]
def z(*args, **options) #

[View source]
def z(*args, **options, &) #

[View source]