2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2009, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
38 /*! \page selmethods Custom selection methods
40 * Custom selection methods are defined by creating a new instance of
41 * \c gmx_ana_selmethod_t and filling it with the necessary data for handling
43 * The structure contains callback pointers that define the actual behavior
45 * The following sections discuss how the structure should be filled and how
46 * to implement the callbacks.
49 * \section selmethods_define \c gmx_ana_selmethod_t data structure
51 * An example \c gmx_ana_selmethod_t definition could look like this:
54 * gmx_ana_selmethod_t sm_example = {
55 * "example", GROUP_VALUE, 0,
56 * asize(sm_params_example), sm_params_example,
62 * &init_frame_example,
65 * {"example from POS_EXPR [cutoff REAL]", 0, NULL},
69 * The first value defines the name of the method.
70 * It is used mostly for informational purposes; the actual name(s) recognized
71 * by the selection parser are defined by the call to
72 * gmx_ana_selmethod_register() (see \ref selmethods_register).
74 * The second value defines the type of the value the method returns.
76 * - \ref NO_VALUE : This is allowed only for methods that have the flag
77 * \ref SMETH_MODIFIER set (see \ref selmethods_modifiers).
78 * - \ref INT_VALUE : The method returns one or more integer values.
79 * - \ref REAL_VALUE : The method returns one or more floating-point values.
80 * - \ref STR_VALUE : The method returns one or more strings.
81 * - \ref POS_VALUE : The method returns one or more 3D vectors.
82 * - \ref GROUP_VALUE : The method returns a single index group.
84 * The third value gives additional information about the method using
85 * a combination of flags.
87 * - \ref SMETH_REQTOP : If set, the topology information is always loaded
88 * and the \p top pointer passed to the callbacks is guaranteed to be
89 * non-NULL. Should be set if the method requires topology information
91 * - \ref SMETH_DYNAMIC : If set, the method can only be evaluated dynamically,
92 * i.e., it requires data from the trajectory frame.
93 * - \ref SMETH_MODIFIER : If set, the method is a selection modifier and
94 * not an actual selection method.
95 * For more details, see \ref selmethods_modifiers.
97 * There are two additional flags that specify the number of values the
98 * method returns. Only one of them can be set at a time.
99 * If neither is set, the default behavior is to evaluate a value for each
100 * input atom (except for \ref GROUP_VALUE methods, which always return a
102 * Other behaviors can be specified with these flags:
103 * - \ref SMETH_SINGLEVAL : If set, the method evaluates to a single value.
104 * This is automatically set if the type is \ref GROUP_VALUE.
105 * - \ref SMETH_VARNUMVAL : If set, the method evaluates to an arbitrary
107 * The number of values is determined based on the values given by the user
108 * to the method parameters (see \ref selmethods_params).
110 * If either of these flags is specified (and the method type is not
111 * \ref GROUP_VALUE), the group passed to the evaluation callback should not
112 * be used as it can be NULL.
113 * Currently, the above flags only work (have been tested) for \ref POS_VALUE
116 * There is one additional flag that can only be specified for \ref STR_VALUE
117 * methods: \ref SMETH_CHARVAL . It is meant for to ease implementation of
118 * methods that evaluate to strings consisting of single characters.
120 * The next two values determine the number of parameters and a pointer to
121 * the parameter array. The contents of the parameter array are described in
122 * \ref selmethods_params. If the method does not take parameters, the first
123 * value should be 0 and the second can be NULL.
124 * Currently, \ref STR_VALUE methods cannot take parameters, but this limitation
125 * should be easy to lift if required.
127 * These are followed by function callbacks that determine the
128 * actual behavior of the method. Any of these except the evaluation callback
129 * can be NULL (the evaluation callback can also be NULL if \ref NO_VALUE is
130 * specified for a selection modifier). However, the presence of parameters
131 * can require some of the callbacks to be implemented.
132 * The details are described in \ref selmethods_callbacks.
134 * Finally, there is a data structure that gives help texts for the method.
136 * The \c gmx_ana_selmethod_t variable should be declared as a global variable
137 * or it should be otherwise ensured that the structure is not freed: only a
138 * pointer to the structure is stored by the library.
141 * \section selmethods_params Defining parameters
143 * Parameters to selection methods are defined in a separate array of
144 * \c gmx_ana_selparam_t structures.
145 * The order of the parameters does not matter (except possibly for callback
146 * implementation), with one important exception:
147 * If the method evaluates to a \ref POS_VALUE, the first parameter should
148 * have \ref GROUP_VALUE and be the one that is used to calculate the
151 * An example parameter definition:
153 * static gmx_ana_selparam_t sm_params_example[] = {
154 * {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
155 * {"from", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
159 * The first value gives the name of the parameter.
160 * The first parameter can have a NULL name, which means that the value should
161 * immediately follow the method name. This can be used to specify methods
162 * of the type 'within 5 of ...'.
164 * The second value specifies the type of the value that the parameter accepts.
165 * \ref NO_VALUE can be used to specify a boolean parameter, other possibilities
166 * are the same as for the selection method type.
168 * The third value gives the number of values that the parameter accepts.
169 * For boolean parameters (\ref NO_VALUE), it should be 0.
170 * For parameters with \ref SPAR_VARNUM of \ref SPAR_ATOMVAL, it should be set
171 * to -1 for consistency (it is not used).
172 * If \ref SPAR_RANGES is specified, it should be either 1 (to accept a single
173 * continuous range) or -1 (if combined with \ref SPAR_VARNUM).
174 * In all other cases, it should be a positive integer; in most cases, it
177 * The nest two pointers should always be NULL (they should be initialized in
178 * the callbacks), except the first pointer in the case of \ref SPAR_ENUMVAL
181 * The final value gives additional information about the acceptable values
182 * for the parameter using a combination of flags.
183 * The possible flags are:
184 * - \ref SPAR_OPTIONAL : If set, the user does not need to provide a value
185 * for the parameter. If not set, an error is reported if the parameter
186 * is not specified by the user.
187 * - \ref SPAR_DYNAMIC : If set, the method can handle dynamic values for
188 * the parameter, i.e., the value(s) can be given by an expression that
189 * evaluates to different values for different frames.
190 * - \ref SPAR_RANGES : Can be set only for \ref INT_VALUE and
191 * \ref REAL_VALUE parameters,
192 * and cannot be combined with \ref SPAR_DYNAMIC.
193 * If set, the parameter accepts ranges of values.
194 * The ranges are automatically sorted and compacted such that a minimum
195 * amount of non-overlapping ranges are given for the method.
196 * - \ref SPAR_VARNUM : If set, the parameter can have a variable number
197 * of values. These can be provided by the user as a list of values, or
198 * using a single \ref SMETH_VARNUMVAL (or a single \ref SMETH_SINGLEVAL)
200 * - \ref SPAR_ATOMVAL : If set, the parameter accepts either a single value
201 * or an expression that evaluates to a value for each input atom.
202 * The single input value is treated as if the same value was returned for
204 * Cannot be combined with \ref SPAR_RANGES or \ref SPAR_VARNUM.
205 * - \ref SPAR_ENUMVAL : Can only be set for \ref STR_VALUE parameters that
206 * take a single value, and cannot be combined with any other flag than
207 * \ref SPAR_OPTIONAL. If set, the parameter only accepts one of predefined
208 * string values. See \ref SPAR_ENUMVAL documentation for details on how
209 * to specify the acceptable values.
212 * \section selmethods_callbacks Implementing callbacks
214 * There are eight differen callback functions that can be implemented for
215 * selection methods: sel_datafunc(), sel_posfunc(), sel_initfunc(),
216 * sel_outinitfunc(), sel_freefunc(), sel_framefunc(), and two update functions.
217 * They are in this order in the \c gmx_ana_selmethod_t data structure.
218 * In general, any of the callbacks can be NULL, but the presence of
219 * parameters or other callbacks imposes some restrictions:
220 * - sel_datafunc() should be provided if the method takes parameters.
221 * - sel_initfunc() should be provided if the method takes
222 * any parameters with the \ref SPAR_VARNUM or \ref SPAR_ATOMVAL flags,
223 * except if those parameters have a \ref POS_VALUE.
224 * - sel_outinitfunc() should be provided for \ref POS_VALUE methods
225 * and \ref SMETH_VARNUMVAL methods.
226 * - sel_freefunc() should be provided if sel_datafunc() and/or
227 * sel_initfunc() allocate any dynamic memory in addition to the data
229 * - sel_updatefunc_pos() only makes sense for methods with \ref SMETH_DYNAMIC
231 * - At least one update function should be provided unless the method type is
234 * The documentations for the function pointer types provide more information
235 * about how the callbacks should be implemented.
238 * \section selmethods_modifiers Selection modifiers
240 * Selection modifiers are a special kind of selection methods that can be
241 * appended to the end of a selection. They are specified by adding the
242 * \ref SMETH_MODIFIER flag to the \c gmx_ana_selmethod_t.
243 * They can have two different types:
244 * - \ref POS_VALUE : These modifiers are given the final positions
245 * as an input, and they can make modifications to the selection that are
246 * not possible otherwise (e.g., permute the atoms).
247 * The modifier should implement sel_updatefunc_pos() and also have
248 * one NULL parameter in the beginning of the parameter list that takes
249 * \ref POS_VALUE and is used to give the input positions.
250 * - \ref NO_VALUE : These modifiers do not modify the final selection, but
251 * can be used to implement per-selection options for analysis tools
252 * or to control the default behavior of the selection engine
253 * (currently, such a framework is not implemented, but should be easy to
254 * implement if required).
256 * In addition to restricting the type of the method, selection modifiers
257 * do not allow the flags \ref SMETH_SINGLEVAL and \ref SMETH_VARNUMVAL
258 * (they would not make sense).
260 * Parameters and callbacks should be implemented as with normal selection
261 * method, but beware that very little of the functionality has been tested.
264 * The modifier handling could be made more flexible and more generic;
265 * the current implementation does not allow many things which would be
266 * possible with slight changes in the internals of the library.
269 * \section selmethods_register Registering the method
271 * After defining the method with \c gmx_ana_selmethod_t, it should be
272 * registered with the selection engine.
273 * In analysis programs, this can be done by calling
274 * gmx_ana_selmethod_register().
275 * If adding the method to the library, you should add a pointer to the new
276 * method structure into the \c smtable_def array (in \ref selmethod.c
277 * "selmethod.c"), and it is registered automatically.
278 * In both cases, gmx_ana_selmethod_register() does several checks on the
279 * structure and reports any errors or inconsistencies it finds.
282 * \brief API for handling selection methods.
284 * There should be no need to use the data structures or call the
285 * functions in this file directly unless implementing a custom selection
288 * Instructions for implementing custom selection methods can be found
289 * on a separate page: \ref selmethods
294 #include "typedefs.h"
296 #include "indexutil.h"
297 #include "selparam.h"
298 #include "selvalue.h"
305 struct gmx_ana_pos_t
;
306 struct gmx_ana_poscalc_coll_t
;
307 struct gmx_ana_selcollection_t
;
309 /*! \name Selection method flags
310 * \anchor selmethod_flags
314 * If set, the method requires topology information.
316 #define SMETH_REQTOP 1
318 * If set, the method can only be evaluated dynamically.
320 #define SMETH_DYNAMIC 2
322 * If set, the method evaluates to a single value.
324 * The default is that the method evaluates to a value for each input atom.
325 * Cannot be combined with \ref SMETH_VARNUMVAL.
327 #define SMETH_SINGLEVAL 4
329 * If set, the method evaluates to an arbitrary number of values.
331 * The default is that the method evaluates to a value for each input atom.
332 * Cannot be combined with \ref SMETH_SINGLEVAL or with \ref GROUP_VALUE.
334 #define SMETH_VARNUMVAL 8
336 * If set, the method evaluates to single-character strings.
338 * This flag can only be set for \ref STR_VALUE methods. If it is set, the
339 * selection engine automatically allocates and frees the required strings.
340 * The evaluation function should store the character values as the first
341 * character in the strings in the output data structure and should not change
342 * the string pointers.
344 #define SMETH_CHARVAL 64
346 * If set, the method is a selection modifier.
348 * The method type should be \ref GROUP_VALUE or \ref NO_VALUE .
349 * Cannot be combined with \ref SMETH_SINGLEVAL or \ref SMETH_VARNUMVAL .
351 #define SMETH_MODIFIER 256
355 * Allocates and initializes internal data and parameter values.
357 * \param[in] npar Number of parameters in \p param.
358 * \param[in,out] param Pointer to (a copy of) the method's
359 * \c gmx_ana_selmethod_t::param.
360 * \returns Pointer to method-specific data structure.
361 * This pointer will be passed as the last parameter of all other function
363 * Should return NULL on error (only error that should occur is out of
366 * Should allocate and initialize any internal data required by the method.
367 * Should also initialize the value pointers (\c gmx_ana_selparam_t::val) in
368 * \p param to point to variables within the internal data structure,
369 * with the exception of parameters that specify the \ref SPAR_VARNUM or
370 * the \ref SPAR_ATOMVAL flag (these should be handled in sel_initfunc()).
371 * However, parameters with a position value should be initialized.
372 * It is also possible to initialize \ref SPAR_ENUMVAL statically outside
373 * this function (see \ref SPAR_ENUMVAL).
374 * The \c gmx_ana_selparam_t::nvalptr should also be initialized for
375 * non-position-valued parameters that have both \ref SPAR_VARNUM and
376 * \ref SPAR_DYNAMIC set (it can also be initialized for other parameters if
377 * desired, but the same information will be available through other means).
378 * For optional parameters, the default values can (and should) be initialized
379 * here, as the parameter values are not changed if the parameter is not
382 * For boolean parameters (type equals \ref NO_VALUE), the default value
383 * should be set here. The user can override the value by giving the parameter
384 * either as 'NAME'/'noNAME', or as 'NAME on/off/yes/no'.
386 * If the method takes any parameters, this function must be provided.
388 typedef void *(*sel_datafunc
)(int npar
, gmx_ana_selparam_t
*param
);
390 * Sets the position calculation collection for the method.
392 * \param[in] pcc Position calculation collection that the method should use
393 * for position calculations.
394 * \param data Internal data structure from sel_datafunc().
396 * This function should be provided if the method uses the routines from
397 * poscalc.h for calculating positions.
398 * The pointer \p pcc should then be stored and used for initialization for
399 * any position calculation structures.
401 typedef void (*sel_posfunc
)(struct gmx_ana_poscalc_coll_t
*pcc
, void *data
);
403 * Does initialization based on topology and/or parameter values.
405 * \param[in] top Topology structure
406 * (can be NULL if \ref SMETH_REQTOP is not set).
407 * \param[in] npar Number of parameters in \p param.
408 * \param[in] param Pointer to (an initialized copy of) the method's
409 * \c gmx_ana_selmethod_t::param.
410 * \param data Internal data structure from sel_datafunc().
411 * \returns 0 on success, a non-zero error code on failure.
413 * This function is called after the parameters have been processed:
414 * the values of the parameters are stored at the locations set in
416 * The flags \ref SPAR_DYNAMIC and \ref SPAR_ATOMVAL are cleared before
417 * calling the function if the value is static or single-valued, respectively.
418 * If a parameter had the \ref SPAR_VARNUM or \ref SPAR_ATOMVAL flag (and
419 * is not \ref POS_VALUE), a pointer to the memory allocated for the values is
420 * found in \c gmx_ana_selparam_t::val.
421 * The pointer should be stored by this function, otherwise the values
422 * cannot be accessed.
423 * For \ref SPAR_VARNUM parameters, the number of values can be accessed
424 * through \c gmx_ana_selparam_t::val. For parameters with \ref SPAR_DYNAMIC,
425 * the number is the maximum number of values (the actual number can be
426 * accessed in sel_framefunc() and in the update callback through the value
427 * pointed by \c gmx_ana_selparam_t::nvalptr).
428 * For \ref SPAR_ATOMVAL parameters, \c gmx_ana_selparam_t::val::nr is set to
429 * 1 if a single value was provided, otherwise it is set to the maximum number
430 * of values possibly passed to the method.
431 * The value pointed by \c gmx_ana_selparam_t::nvalptr always contains the same
432 * value as \c gmx_ana_selparam_t::val::nr.
434 * For dynamic \ref GROUP_VALUE parameters (\ref SPAR_DYNAMIC set), the value
435 * will be the largest possible selection that may occur during the
436 * evaluation. For other types of dynamic parameters, the values are
439 * If the method takes any parameters with the \ref SPAR_VARNUM or
440 * \ref SPAR_ATOMVAL flags, this function must be provided, except if these
441 * parameters all have \ref POS_VALUE.
443 * This function may be called multiple times for the same method if the
444 * method takes parameters with \ref SPAR_ATOMVAL set.
446 typedef int (*sel_initfunc
)(t_topology
*top
, int npar
,
447 gmx_ana_selparam_t
*param
, void *data
);
449 * Initializes output data structure.
451 * \param[in] top Topology structure
452 * (can be NULL if \ref SMETH_REQTOP is not set).
453 * \param[in,out] out Output data structure.
454 * \param[in] data Internal data structure from sel_datafunc().
455 * \returns 0 on success, an error code on error.
457 * This function is called immediately after sel_initfunc().
459 * If the method evaluates to a position (\ref POS_VALUE), this function
460 * should be provided, and it should initialize the \c gmx_ana_pos_t data
461 * structure pointed by \p out.p (the pointer is guaranteed to be non-NULL).
462 * The \p out.p->g pointer should be initialized to the group that is used
463 * to evaluate positions in sel_updatefunc() or sel_updatefunc_pos().
465 * The function should also be provided for non-position-valued
466 * \ref SMETH_VARNUMVAL methods. For these methods, it suffices to set the
467 * \p out->nr field to reflect the maximum number of values returned by the
470 * Currently, this function is not needed for other types of methods.
472 * This function may be called multiple times for the same method if the
473 * method takes parameters with \ref SPAR_ATOMVAL set.
475 typedef int (*sel_outinitfunc
)(t_topology
*top
, gmx_ana_selvalue_t
*out
,
478 * Frees the internal data.
480 * \param[in] data Internal data structure from sel_datafunc().
482 * This function should be provided if the internal data structure contains
483 * dynamically allocated data, and should free any such data.
484 * The data structure itself should not be freed; this is handled automatically.
485 * If there is no dynamically allocated data within the structure,
486 * this function is not needed.
487 * Any memory pointers received as values of parameters are managed externally,
488 * and should not be freed.
489 * Pointers set as the value pointer of \ref SPAR_ENUMVAL parameters should not
492 typedef void (*sel_freefunc
)(void *data
);
495 * Initializes the evaluation for a new frame.
497 * \param[in] top Topology structure
498 * (can be NULL if \ref SMETH_REQTOP is not set).
499 * \param[in] fr Current frame.
500 * \param[in] pbc Initialized periodic boundary condition structure,
501 * or NULL if PBC should not be used.
502 * \param data Internal data structure from sel_datafunc().
503 * \returns 0 on success, a non-zero error code on failure.
505 * This function should be implemented if the selection method needs to
506 * do some preprocessing for each frame, and the preprocessing does not
507 * depend on the evaluation group.
508 * Because \p sel_updatefunc_* can be called more than once for a frame,
509 * it is inefficient do the preprocessing there.
510 * It is ensured that this function will be called before
511 * \p sel_updatefunc_* for each frame, and that it will be called at most
512 * once for each frame.
513 * For static methods, it is called once, with \p fr and \p pbc set to
516 typedef int (*sel_framefunc
)(t_topology
*top
, t_trxframe
*fr
, t_pbc
*pbc
,
519 * Evaluates a selection method.
521 * \param[in] top Topology structure
522 * (can be NULL if \ref SMETH_REQTOP is not set).
523 * \param[in] fr Current frame.
524 * \param[in] pbc Initialized periodic boundary condition structure,
525 * or NULL if PBC should not be used.
526 * \param[in] g Index group for which the method should be evaluated.
527 * \param[out] out Output data structure.
528 * \param data Internal data structure from sel_datafunc().
529 * \returns 0 on success, a non-zero error code on error.
531 * This function should evaluate the method for each atom included in \p g,
532 * and write the output to \p out. The pointer in the union \p out->u that
533 * corresponds to the type of the method should be used.
534 * Enough memory has been allocated to store the output values.
535 * The number of values in \p out should also be updated if necessary.
536 * However, \ref POS_VALUE or \ref GROUP_VALUE methods should not touch
537 * \p out->nr (it should be 1 anyways).
539 * For \ref STR_VALUE methods, the pointers stored in \p out->s are discarded
540 * without freeing; it is the responsibility of this function to provide
541 * pointers that can be discarded without memory leaks.
543 typedef int (*sel_updatefunc
)(t_topology
*top
, t_trxframe
*fr
, t_pbc
*pbc
,
544 gmx_ana_index_t
*g
, gmx_ana_selvalue_t
*out
,
547 * Evaluates a selection method using positions.
549 * \param[in] top Topology structure
550 * (can be NULL if \ref SMETH_REQTOP is not set).
551 * \param[in] fr Current frame.
552 * \param[in] pbc Initialized periodic boundary condition structure,
553 * or NULL if PBC should not be used.
554 * \param[in] pos Positions for which the method should be evaluated.
555 * \param[out] out Output data structure.
556 * \param data Internal data structure from sel_datafunc().
557 * \returns 0 on success, a non-zero error code on error.
559 * This function should evaluate the method for each position in \p g,
560 * and write the output values to \p out. The pointer in the union \p out->u
561 * that corresponds to the type of the method should be used.
562 * Enough memory has been allocated to store the output values.
563 * The number of values in \p out should also be updated if necessary.
564 * However, \ref POS_VALUE or \ref GROUP_VALUE methods should not touch
565 * \p out->nr (it should be 1 anyways).
567 * For \ref STR_VALUE methods, the pointers stored in \p out->s are discarded
568 * without freeing; it is the responsibility of this function to provide
569 * pointers that can be discarded without memory leaks.
571 typedef int (*sel_updatefunc_pos
)(t_topology
*top
, t_trxframe
*fr
, t_pbc
*pbc
,
572 struct gmx_ana_pos_t
*pos
,
573 gmx_ana_selvalue_t
*out
,
577 * Help information for a selection method.
579 * If some information is not available, the corresponding field can be set to
582 typedef struct gmx_ana_selmethod_help_t
585 * One-line description of the syntax of the method.
587 * If NULL, the name of the method is used.
591 * Number of strings in \p help.
593 * Set to 0 if \p help is NULL.
597 * Detailed help for the method.
599 * If there is no help available in addition to \p syntax, this can be set
603 } gmx_ana_selmethod_help_t
;
606 * Describes a selection method.
608 * Any of the function pointers except the update call can be NULL if the
609 * operation is not required or not supported. In this case,
610 * corresponding function calls are skipped.
612 * See the function pointer type documentation for details of how the
613 * functions should be implemented.
614 * More details on implementing new selection methods can be found on a
615 * separate page: \ref selmethods.
617 typedef struct gmx_ana_selmethod_t
619 /** Name of the method. */
621 /** Type which the method returns. */
624 * Flags to specify how the method should be handled.
626 * See \ref selmethod_flags for allowed values.
629 /** Number of parameters the method takes. */
631 /** Pointer to the array of parameter descriptions. */
632 gmx_ana_selparam_t
*param
;
634 /** Function for allocating and initializing internal data and parameters. */
635 sel_datafunc init_data
;
636 /** Function to set the position calculation collection. */
637 sel_posfunc set_poscoll
;
638 /** Function to do initialization based on topology and/or parameter values. */
640 /** Function to initialize output data structure. */
641 sel_outinitfunc outinit
;
642 /** Function to free the internal data. */
645 /** Function to initialize the calculation for a new frame. */
646 sel_framefunc init_frame
;
647 /** Function to evaluate the value. */
648 sel_updatefunc update
;
649 /** Function to evaluate the value using positions. */
650 sel_updatefunc_pos pupdate
;
652 /** Help data for the method. */
653 gmx_ana_selmethod_help_t help
;
654 } gmx_ana_selmethod_t
;
656 /** Registers a selection method. */
658 gmx_ana_selmethod_register(struct gmx_ana_selcollection_t
*sc
,
659 const char *name
, gmx_ana_selmethod_t
*method
);
660 /** Registers all selection methods in the library. */
662 gmx_ana_selmethod_register_defaults(struct gmx_ana_selcollection_t
*sc
);
664 /** Finds a parameter from a selection method by name. */
666 gmx_ana_selmethod_find_param(const char *name
, gmx_ana_selmethod_t
*method
);