Function manipulating CHFL_SELECTIONΒΆ

CHFL_SELECTION * chfl_selection(const char * selection)

Create a new selection from the given selection string.

Return
A pointer to the corresponding selection, or NULL in case of error

int chfl_selection_size(const CHFL_SELECTION * selection, size_t * size)

Get the size of the selection, i.e. the number of atoms we are selecting together.

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ context, 3 for the ‘three’ and ‘angles’ contextes and 4 for the ‘four’ and ‘dihedral’ contextes.

Return
The status code
Parameters
  • selection -

    The selection

  • size -

    The size of the selection

int chfl_selection_evalutate(CHFL_SELECTION * selection, const CHFL_FRAME * frame, size_t * n_matches)

Evaluate a selection for a given frame.

Use the chfl_selection_get function to get the matches for this selection.

Return
The status code
Parameters
  • selection -

    The selection

  • frame -

    The frame

  • n_matches -

    The number of matches for the selection

int chfl_selection_matches(const CHFL_SELECTION * selection, chfl_match_t matches[], size_t n_matches)

Get the matches for a selection after a call to chfl_selection_evalutate

Return
The status code
Parameters
  • selection -

    the selection

  • matches -

    a pre-allocated array of size (number of matches)

  • n_matches -

    the number of matches, as indicated by chfl_selection_evaluate

int chfl_selection_free(CHFL_SELECTION * selection)

Destroy a selection, and free the associated memory.

Return
The status code
Parameters
  • selection -

    The selection to destroy

struct chfl_match_t

A match from a selection evaluation.

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 Members

unsigned char size

The actual size of the match. Elements in matches are significant up to this value, and filled with (size_t)-1 for all the other values.

size_t atoms[CHFL_MAX_SELECTION_SIZE]

Indexes matching the associated selection.

CHFL_MAX_SELECTION_SIZE

Maximal size for a selection match.