chemfiles::
Topology
¶A topology contains the definition of all the atoms in the system, and the liaisons between the particles (bonds, angles, dihedrals, ...).
Only the atoms and the bonds are stored, the angles and the dihedrals are computed automaticaly.
Iterating over a `Topology` will yield the atoms in the system.
Public Functions
Topology
()¶Construct an empty topology.
operator[]
(size_t index) const¶Get a const (non-modifiable) reference to the atom at the position `index`
append
(Atom atom)¶Add an atom in the system.
remove
(size_t i)¶Delete the atom at index `i` in the system. `i` must be lower than `natoms()`.
add_bond
(size_t atom_i, size_t atom_j)¶Add a bond in the system, between the atoms at index `atom_i` and `atom_j`
remove_bond
(size_t atom_i, size_t atom_j)¶Remove a bond in the system, between the atoms at index `atom_i` and `atom_j`
natoms
() const¶Get the number of atoms in the topology.
resize
(size_t natoms)¶Resize the topology to hold `natoms` atoms, adding `UNDEFINED` atoms as needed.
reserve
(size_t natoms)¶Reserve size in the topology to store data for `natoms` atoms.
isbond
(size_t i, size_t j) const¶Check wether the atoms at indexes `i` and `j` are bonded or not.
isangle
(size_t i, size_t j, size_t k) const¶Check wether the atoms at indexes `i`, `j` and `k` constitues an angle
isdihedral
(size_t i, size_t j, size_t k, size_t m) const¶Check wether the atoms at indexes `i` `j`, `k` and `m` constitues a dihedral angle
bonds
() const¶Get the bonds in the system.
angles
() const¶Get the angles in the system.
dihedrals
() const¶Get the dihedral angles in the system.
clear_bonds
()¶Remove all bonding information in the topology (bonds, angles and dihedrals)
add_residue
(Residue residue)¶Add a `residue` to this topology.
This function throws a `chemfiles::Error` if any atom in the `residue` is already in another residue in this topology. In that case, the topology is not modified.
are_linked
(const Residue &first, const Residue &second) const¶Check if two residues are linked together, i.e. if there is a bond between one atom in the `first` residue and one atom in the `second` one.
If `first == second`, this function returns `true`.
residue
(size_t atom) const¶Get the residue containing the `atom` at the given index.
residues
() const¶Get all the residues in the topology.