chfl_selection type

type chfl_selection

chfl_selection allow to select atoms in a chfl_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 == != < <= > >=.

The initialization routines for chfl_selection are chfl_selection%init() and chfl_selection%copy().

Type fields:
subroutine chfl_selection%init(selection[, status])

Initialize the selection with a new selection from the given selection string.

See the selection documentation for the selection language specification.

Parameters:selection [character,len=*] :: The selection string
Options:status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.
subroutine chfl_selection%copy(selection[, status])

Initialize the selection with a copy of selection.

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

Parameters:selection [chfl_selection] :: selection to copy
Options:status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.
subroutine chfl_selection%size(size[, status])

Get the size of the selection in size.

The size of a selection 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.

Parameters:size [integer] :: selection size
Options:status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.
subroutine chfl_selection%string(string, buffsize[, status])

Get the selection string used to create this selection in the string buffer.

The buffer size must be passed in buffsize. This function will truncate the selection string to fit in the buffer.

Parameters:
  • size [character,len=buffsize] :: string buffer to be filled with the initial selection string
  • buffsize [integer] :: size of the string buffer
Options:

status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.

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

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

Parameters:
  • frame [chfl_frame] :: frame to evaluate
  • n_matches [integer] :: number of matches for this selection
Options:

status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.

subroutine chfl_selection%matches(matches, n[, status])

Get the matches for the selection after a call to chfl_selection%evalutate(), in the pre-allocated matches array. The size of the matches array must be passed in n.

Parameters:
  • matches (nmatchs) [chfl_match,allocatable] :: Pre-allocated array of the size given by chfl_selection%evaluate.
  • n [integer] :: size of the matches array
Options:

status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.

subroutine chfl_selection%free([status])

Destroy a selection, and free the associated memory

Options:status [integer,optional, kind=chfl_status] :: status code of the operation. If it is not equal to CHFL_SUCCESS, you can learn more about the error by using chfl_last_error.
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.