class Chem::Structure::Builder
- Chem::Structure::Builder
- Reference
- Object
Defined in:
chem/core/structure/builder.crConstructors
Instance Method Summary
- #atom(name : String, serial : Int32, coords : Spatial::Vec3, element : Element, **options) : Atom
- #atom(name : String, serial : Int32, coords : Spatial::Vec3, **options) : Atom
-
#atom(element : Element | Symbol, coords : Spatial::Vec3, **options) : Atom
Creates an
Atomof element at the given coordinates. - #atom(name : String, coords : Spatial::Vec3, **options) : Atom
- #atom(index : Int) : Atom
- #atom(coords : Spatial::Vec3, **options) : Atom
- #atom?(index : Int) : Atom | Nil
- #bond(name : String, other : String, order : BondOrder = :single) : Bond
- #bond(i : Int, j : Int, order : BondOrder = :single, aromatic : Bool = false) : Bond
- #bonds(bond_table : Hash(Tuple(Int32, Int32), BondOrder)) : Nil
- #build : Structure
- #cell(a : Spatial::Vec3, b : Spatial::Vec3, c : Spatial::Vec3) : Spatial::Parallelepiped
- #cell(a : Float64, b : Float64, c : Float64) : Spatial::Parallelepiped
- #cell(cell : Spatial::Parallelepiped | Nil)
- #cell : Spatial::Parallelepiped | Nil
- #cell! : Spatial::Parallelepiped
- #chain(id : Char) : Chain
- #chain : Chain
- #chain(id : Char, & : self -> ) : Nil
- #chain(& : self -> ) : Nil
- #current_chain : Chain | Nil
- #current_residue : Residue | Nil
- #expt(expt : Structure::Experiment | Nil)
- #residue(name : String, number : Int32, inscode : Char | Nil = nil) : Residue
- #residue(name : String) : Residue
- #residue : Residue
- #residue(name : String, number : Int32, inscode : Char | Nil = nil, & : self -> ) : Nil
- #residue(name : String, & : self -> ) : Nil
- #secondary_structure(i : Tuple(Char, Int32, Char | Nil), j : Tuple(Char, Int32, Char | Nil), type : Protein::SecondaryStructure) : Nil
- #secondary_structure(ri : Residue, rj : Residue, type : Protein::SecondaryStructure)
- #title(title : String)
Constructor Detail
def self.new(guess_bonds : Bool = false, guess_names : Bool = false, use_templates : Bool = false, **options)
#
Instance Method Detail
def atom(name : String, serial : Int32, coords : Spatial::Vec3, element : Element, **options) : Atom
#
Creates an Atom of element at the given coordinates. Extra
named arguments are forwarded to the Atom constructor.
The atom name will set to the element's symbol followed by the number of atoms with the same element within the current residue.
structure = Chem::Structure.build do |builder|
builder.residue
builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
builder.residue
builder.atom Chem::PeriodicTable::H, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::C, Chem::Spatial::Vec3.zero
builder.atom Chem::PeriodicTable::N, Chem::Spatial::Vec3.zero
end
structure.atoms.map(&.name) # => ["H1", "C1", "H2", "H3", "C2", "H1", "C1", "N1"]
Note that the atom names resets on a new residue.
WARNING This method assumes that residues are created in
sequence, so calling #residue will always create a new residue,
not retrieving a preceding one. Otherwise, the order of the atom
names will be reset.
def secondary_structure(i : Tuple(Char, Int32, Char | Nil), j : Tuple(Char, Int32, Char | Nil), type : Protein::SecondaryStructure) : Nil
#