Selection class

class 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> <value> structure, where <operator> is a comparison operator in == != < <= > >=.

Refer to the Selection language documentation to know the allowed selectors and how to use them.

Public Functions

Selection(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

Get the size of the selection, i.e. the number of atoms selected together.

std::string string() const

Get the string used to build this selection

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

Public Functions

const size_t &operator[](size_t i) const

Get the ith atomic index in 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.