TopologyΒΆ

class 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.

Atom & operator[](size_t index)

Get a reference to the atom at the position index

const Atom & operator[](size_t index) const

Get a const (non-modifiable) reference to the atom at the position index

void append(const Atom & _atom)

Add an atom in the system.

void remove(size_t idx)

Delete an atom in the system. If idx is out of bounds, do nothing.

void 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

void 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

size_t natoms() const

Get the number of atoms in the topology.

void resize(size_t natoms)

Resize the topology to hold natoms atoms, adding UNDEFINED atoms as needed.

bool isbond(size_t i, size_t j) const

Check wether the atoms at indexes i and j are bonded or not.

bool isangle(size_t i, size_t j, size_t k) const

Check wether the atoms at indexes i, j and k constitues an angle

bool 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

std::vector< Bond > bonds() const

Get the bonds in the system.

std::vector< Angle > angles() const

Get the angles in the system.

std::vector< Dihedral > dihedrals() const

Get the dihedral angles in the system.

void clear_bonds()

Remove all bonding information in the topology (bonds, angles and dihedrals)