chfl_selection type

type  chfl_selection

chfl_selection allow to get the index of atoms in a chfl_frame, matching a selection language. The matching atoms are given in an array of chfl_match.

Type fields:
type  chfl_match

This type contains the matched atoms for a given selection in the atoms array. Values in the atoms array are valid up to the size of this match. If the match size is 2, then atom(1) and atom(2) are valid, and atom(3) and atom(4) contains invalid indexes.

Type fields:
  • % size [integer] :: The size of this match.

  • % atoms (4) [integer] :: The index of the matched atoms.

subroutine  chfl_selection%init(selection[, status])

Initialize the selection from the given selection string. This subroutine allocate memory which must be released with chfl_selection%free().

See the selection documentation for the selection language specification.

Parameters:

selection [character(len=*)] :: The selection string

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

subroutine  chfl_selection%copy(selection[, status])

Initialize the selection with a copy of selection. This subroutine allocate memory which must be released with chfl_selection%free().

The copy does not contains any state, and chfl_selection%evaluate() must be called again before using chfl_selection%matches().

Parameters:

selection [type(chfl_selection)] :: selection to copy

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

function  chfl_selection%size([status])

Get the size of the selection. This is 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:

integer :: selection size

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

function  chfl_selection%string([status])

Get the selection string used to create this selection. If the string is longer than CHFL_STRING_LENGTH, it will be truncated.

Return:

character (len=CHFL_STRING_LENGTH) :: selection string

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

subroutine  chfl_selection%evaluate(frame, count[, status])

Evaluate the selection for a given frame, and store the number of matches in count. Use chfl_selection%matches() to get the matches.

Parameters:
  • frame [type(chfl_frame)] :: frame to evaluate

  • count [integer] :: number of matches for this selection

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

subroutine  chfl_selection%matches(matches[, status])

Get the matches for the selection after a call to chfl_selection%evalutate(), in the pre-allocated matches array.

Parameters:

matches [type(chfl_match),dimension(:)] :: Array of chfl_match of the size given by chfl_selection%evaluate().

Options:

status [integer(chfl_status)] :: status code of the operation. If it is not CHFL_SUCCESS, use chfl_last_error() to learn more about the error.

subroutine  chfl_selection%free()

Destroy a selection, and free the associated memory