Selection¶
-
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
-
explicit Selection(std::string selection)¶
Create a selection using the given string.
- Throws:
SelectionError – if there is a error in the selection 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.- Throws:
SelectionError – if the selection size is not 1.
-
size_t size() const¶
Get the size of the selection, i.e. the number of atoms selected together.
-
inline std::string string() const¶
Get the string used to build this selection
-
explicit Selection(std::string 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
-
inline const size_t &operator[](size_t i) const¶
Get the
i
th atomic index in the match.- Throws:
OutOfBounds – if the index is bigger than the
size()
of the match
Public Static Attributes
-
static constexpr size_t MAX_MATCH_SIZE = 4¶
Maximal number of atoms in a match.
-
inline const size_t &operator[](size_t i) const¶