class chemfiles::Selection

This class allow to select atoms in a `Frame`, from a selection language.

The selection language is built by combining basic operations. Each basic operation follows the `<selector>[(<variable>)] <operator>

` structure, where `<operator>` is a comparison operator in `== != < <= > >=`. Refer to the full documentation to know the allowed selectors and how to use them.

Public Functions

Selection(const std::string &selection)

Create a selection using the given string.


std::vector<Match> evaluate(const Frame &frame) const

Evaluates the selection on a given `frame`. This function returns the list of matches in the frame for this selection.

std::vector<size_t> list(const Frame &frame) const

Evaluates a selection of size 1 on a given `frame`. This function returns the list of atomic indexes in the frame matching this selection.


size_t size() const

Size of the matches for this selection.

std::string string() const

Get the string used to build this selection.

class chemfiles::Match

A match is a set of atomic indexes matching a given selection. The size of a match depends on the associated selection, and can vary from 1 to 4.

Public Functions

const size_t &operator[](size_t i) const

Get the `i`th index in the match. `i` should be lower than the actual `size()` of the match.

size_t size() const

Size of the match, i.e. number of valid indexes in the match. This value is always equals to the size of the `Selection` this match comes from.

Public Static Attributes

constexpr size_t MAX_MATCH_SIZE = 4

Maximal number of atoms in a match.