class

Chem::Topology

Inherits Chem::ResidueCollection / Chem::ChainCollection / Chem::AtomCollection / Reference / Object

Constants

MAX_CHAINS = 62

Class methods

guess_element(atom_name : String) : Element

Returns the element of an atom based on its name. Raises Error if the element could not be determined. Refer to guess_element? for details.

Source
guess_element?(atom_name : String) : Element | Nil

Returns the element of an atom based on its name if possible, else nil.

This is a naive approach, where the first letter of atom_name is tested first to get the element, then the name with trailing digits stripped.

Source

Instance methods

[](chain_id : Char) : Chain
Source
[]?(chain_id : Char) : Chain | Nil
Source
angles

Returns the angles in the topology. See Angle for definition.

Source
angles=(angles : Array(Chem::Angle))

Angles in the topology. See Angle for definition.

Source
apply_templates

Assign bonds, formal charges, and residue's type from known residue types.

Source
bonds

Returns the bonds between all atoms.

Source
clear
Source
clone
Source
delete(ch : Chain) : Chain | Nil
Source
dig(id : Char) : Chain
Source
dig(id : Char, *subindexes)
Source
dig?(id : Char) : Chain | Nil
Source
dig?(id : Char, *subindexes)
Source
dihedrals

Returns the dihedral angles in the topology. See Dihedral for definition.

Source
dihedrals=(dihedrals : Array(Chem::Dihedral))

Dihedral angles in the topology. See Dihedral for definition.

Source
each_atom
Source
each_atom
Source
each_chain
Source
each_chain
Source
each_residue
Source
each_residue
Source
guess_angles

Determines the angles based on connectivity. See Angle for definition.

NOTE: It deletes existing angles.

Source
guess_bonds(perceive_order : Bool = true) : Nil

Determines the bonds from connectivity and geometry.

Bonds are added when the pairwise distances are within the corresponding covalent distances (see PeriodicTable.covalent_distance). Bonds are added until the atoms' valences are fulfilled. If extraneous bonds are found (beyond the maximum number of bonds, see Element#max_bonds), the longest ones will be removed.

Bonds to atoms that could potential be as cations (K, Na, etc.) are disfavored such that they won't be added if the neighbor is over-valence or the bond can be substituted by increasing the bond order of another bond of the neighbor (e.g., C-O + K is preferred over C-O-K since C-O can be converted to C=O).

Bond orders are assigned based on the following procedure. First, atom hybridization is guessed from the geometry. Then, the bond orders are determined such that both atoms must have the same hybridization to assign a double (sp2) or triple (sp) bond. Bond order is only changed if the bonded atoms have missing valence. If multiple bonded atoms fulfill the requirements for increasing the bond order, the atom with the most missing valence or that is closest to the current atom is selected first. This procedure is loosely based on OpenBabel's PerceiveBondOrders function.

Source
guess_dihedrals

Determines the dihedral angles based on connectivity. See Dihedral for definition.

NOTE: It deletes existing dihedral angles.

Source
guess_formal_charges

Sets the formal charges based on the existing bonds.

For most cases, the formal charge is calculated as

Nele - Tele + V

where Nele is the number of valence electrons, Tele is the number of electrons in the full valence shell, and V is the effective valence, which is equivalent to the sum of the bond orders. Tele is usually 8 following the octet rule, but there are some exceptions (see Element#target_electrons).

If an atom has no bonds, it is considered as a monoatomic ion, where the formal charge is set according to the following rule: if the valence electrons < 4 (cation, e.g., Na+, Mg2+), the formal charge is equal to the number of valence electrons, else (anions, e.g., Cl-) it is equal to Nele - Tele.

WARNING: Elements that have no valence determined such as transition metals are ignored.

Source
guess_impropers

Determines the improper dihedral angles based on connectivity. See Improper for definition.

Improper dihedral angles are often used to constraint the planarity of certain functional groups of molecules in molecular mechanics simulations, and so not every possible improper dihedral angle is required. This method lists every possible improper dihedral angle following the formal definition, which will probably generate extraneous angles.

NOTE: It deletes existing improper dihedral angles.

Source
guess_names

Detects and assigns topology names from known residue templates based on bond information.

The method creates chains and residues according to the detected fragments and residue matches. The procedure is as follows. First, atoms are split into fragments, where each fragment is scanned for matches to known residue templates. Then, fragments are divided into polymer (e.g., peptide) and non-polymer (e.g., water) fragments based on the number of residues per fragment. Non-polymer residues are grouped together by their type (i.e., ion, solvent, etc.). Finally, every polymer fragment and group of non-polymer fragments are assigned to a unique chain and residues are created for each match.

NOTE: Fragments are assigned to a unique chain unless the chain limit (62) is reached, otherwise all residues are assigned to the same chain.

WARNING: Existing chains and residues are invalid after calling this method so do not cache them.

Source
guess_unknown_residue_types

Determines the type of unknown residues based on their neighbors.

Source
impropers

Returns the improper dihedral angles in the topology. See Improper for definition.

Source
impropers=(impropers : Array(Chem::Improper))

Improper dihedral angles in the topology. See Improper for definition.

Source
n_atoms
Source
n_chains
Source
n_residues
Source
renumber_residues_by

Renumber residues per chain based on the order by the output value of the block.

NOTE: This won't change the order of the existing chains.

Source
renumber_residues_by_connectivity(split_chains : Bool = true) : Nil

Renumber chain and residues based on bond information.

Residue fragments are assigned to unique chains unless split_chains is false, which keeps existing chains intact. Residue ordering is computed based on the link bond if available.

NOTE: existing chains are reused to re-arrang the residues among them, so avoid caching them before calling this.

Source
structure
Source
structure=(structure : Structure)
Source