chfl_selection
type¶
- type chfl_selection¶
chfl_selection
allow to get the index of atoms in achfl_frame
, matching a selection language. The matching atoms are given in an array ofchfl_match
.- Type fields:
% init [subroutine] ::
chfl_selection%init()
% copy [subroutine] ::
chfl_selection%copy()
% size [function] ::
chfl_selection%size()
% string [function] ::
chfl_selection%string()
% evaluate [subroutine] ::
chfl_selection%evaluate()
% matches [subroutine] ::
chfl_selection%matches()
% free [subroutine] ::
chfl_selection%free()
- type chfl_match¶
This type contains the matched atoms for a given selection in the
atoms
array. Values in theatoms
array are valid up to thesize
of this match. If the match size is 2, thenatom(1)
andatom(2)
are valid, andatom(3)
andatom(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 withchfl_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
, usechfl_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 withchfl_selection%free()
.The copy does not contains any state, and
chfl_selection%evaluate()
must be called again before usingchfl_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
, usechfl_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
, usechfl_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
, usechfl_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 incount
. Usechfl_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
, usechfl_last_error()
to learn more about the error.
- subroutine chfl_selection%matches(matches[, status])¶
Get the matches for the
selection
after a call tochfl_selection%evalutate()
, in the pre-allocatedmatches
array.- Parameters:
matches [type(chfl_match),dimension(:)] :: Array of
chfl_match
of the size given bychfl_selection%evaluate()
.- Options:
status [integer(chfl_status)] :: status code of the operation. If it is not
CHFL_SUCCESS
, usechfl_last_error()
to learn more about the error.
- subroutine chfl_selection%free()¶
Destroy a selection, and free the associated memory