class Chem::Atom
- Chem::Atom
- Reference
- Object
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.crConstructors
Instance Method Summary
-
#<=>(rhs : self) : Int32
The comparison operator.
-
#===(element : Element) : Bool
Case equality.
-
#===(atom_t : Topology::AtomType) : Bool
Case equality.
- #atomic_number(*args, **options)
- #atomic_number(*args, **options, &)
- #bonded?(to other : self) : Bool
- #bonded_atoms : Array(Atom)
- #bonds : BondArray
- #chain(*args, **options)
- #chain(*args, **options, &)
- #constraint : Constraint | Nil
- #constraint=(constraint : Constraint | Nil)
- #coords : Spatial::Vector
- #coords=(coords : Spatial::Vector)
- #covalent_radius(*args, **options)
- #covalent_radius(*args, **options, &)
- #each_bonded_atom : Iterator(Atom)
- #each_bonded_atom(& : self -> ) : Nil
- #element : Element
- #element=(element : Element)
- #formal_charge : Int32
- #formal_charge=(formal_charge : Int32)
- #inspect(io : ::IO)
- #mass : Float64
- #mass=(mass : Float64)
-
#match?(atom_t : Topology::AtomType) : Bool
Matches self against atom_t.
- #max_valency(*args, **options)
- #max_valency(*args, **options, &)
- #missing_valency : Int32
- #name : String
- #name=(name : String)
- #nominal_valency : Int32
- #occupancy : Float64
- #occupancy=(occupancy : Float64)
- #partial_charge : Float64
- #partial_charge=(partial_charge : Float64)
- #residue : Residue
- #residue=(new_res : Residue) : Residue
- #serial : Int32
- #serial=(serial : Int32)
- #temperature_factor : Float64
- #temperature_factor=(temperature_factor : Float64)
- #to_s(io : ::IO)
- #valency : Int32
- #vdw_radius : Float64
- #vdw_radius=(vdw_radius : Float64)
- #within_covalent_distance?(rhs : self) : Bool
- #x(*args, **options)
- #x(*args, **options, &)
- #y(*args, **options)
- #y(*args, **options, &)
- #z(*args, **options)
- #z(*args, **options, &)
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)
#
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
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"
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"
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