3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
9 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11 * Copyright (c) 2001-2009, The GROMACS development team,
12 * check out http://www.gromacs.org for more information.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * If you want to redistribute modifications, please consider that
20 * scientific software is very special. Version control is crucial -
21 * bugs must be traceable. We will be happy to consider code for
22 * inclusion in the official distribution, but derived work must not
23 * be called official GROMACS. Details are found in the README & COPYING
24 * files - if they are missing, get the official version at www.gromacs.org.
26 * To help us fund GROMACS development, we humbly ask that you cite
27 * the papers on the package - you can find them in the top README file.
29 * For more info, check our website at http://www.gromacs.org
31 /*! \page page_module_selection_custom Custom selection methods
33 * Custom selection methods are defined by creating a new instance of
34 * \c gmx_ana_selmethod_t and filling it with the necessary data for handling
36 * The structure contains callback pointers that define the actual behavior
38 * The following sections discuss how the structure should be filled and how
39 * to implement the callbacks.
42 * \section selmethods_define \c gmx_ana_selmethod_t data structure
44 * An example \c gmx_ana_selmethod_t definition could look like this:
47 gmx_ana_selmethod_t sm_example = {
48 "example", GROUP_VALUE, 0,
49 asize(sm_params_example), sm_params_example,
58 {"example from POS_EXPR [cutoff REAL]", 0, NULL},
62 * The first value defines the name of the method.
63 * It is used mostly for informational purposes; the actual name(s) recognized
64 * by the selection parser are defined by the call to
65 * gmx_ana_selmethod_register() (see \ref selmethods_register).
67 * The second value defines the type of the value the method returns.
69 * - \ref NO_VALUE : This is allowed only for methods that have the flag
70 * \ref SMETH_MODIFIER set (see \ref selmethods_modifiers).
71 * - \ref INT_VALUE : The method returns one or more integer values.
72 * - \ref REAL_VALUE : The method returns one or more floating-point values.
73 * - \ref STR_VALUE : The method returns one or more strings.
74 * - \ref POS_VALUE : The method returns one or more 3D vectors.
75 * - \ref GROUP_VALUE : The method returns a single index group.
77 * The third value gives additional information about the method using
78 * a combination of flags.
80 * - \ref SMETH_REQTOP : If set, the topology information is always loaded
81 * and the \p top pointer passed to the callbacks is guaranteed to be
82 * non-NULL. Should be set if the method requires topology information
84 * - \ref SMETH_DYNAMIC : If set, the method can only be evaluated dynamically,
85 * i.e., it requires data from the trajectory frame.
86 * - \ref SMETH_MODIFIER : If set, the method is a selection modifier and
87 * not an actual selection method.
88 * For more details, see \ref selmethods_modifiers.
90 * There are two additional flags that specify the number of values the
91 * method returns. Only one of them can be set at a time.
92 * If neither is set, the default behavior is to evaluate a value for each
93 * input atom (except for \ref GROUP_VALUE methods, which always return a
95 * Other behaviors can be specified with these flags:
96 * - \ref SMETH_SINGLEVAL : If set, the method evaluates to a single value.
97 * This is automatically set if the type is \ref GROUP_VALUE.
98 * - \ref SMETH_VARNUMVAL : If set, the method evaluates to an arbitrary
100 * The number of values is determined based on the values given by the user
101 * to the method parameters (see \ref selmethods_params).
103 * If either of these flags is specified (and the method type is not
104 * \ref GROUP_VALUE), the group passed to the evaluation callback should not
105 * be used as it can be NULL.
106 * Currently, the above flags only work (have been tested) for \ref POS_VALUE
109 * There is one additional flag that can only be specified for \ref STR_VALUE
110 * methods: \ref SMETH_CHARVAL . It is meant for to ease implementation of
111 * methods that evaluate to strings consisting of single characters.
113 * The next two values determine the number of parameters and a pointer to
114 * the parameter array. The contents of the parameter array are described in
115 * \ref selmethods_params. If the method does not take parameters, the first
116 * value should be 0 and the second can be NULL.
117 * Currently, \ref STR_VALUE methods cannot take parameters, but this limitation
118 * should be easy to lift if required.
120 * These are followed by function callbacks that determine the
121 * actual behavior of the method. Any of these except the evaluation callback
122 * can be NULL (the evaluation callback can also be NULL if \ref NO_VALUE is
123 * specified for a selection modifier). However, the presence of parameters
124 * can require some of the callbacks to be implemented.
125 * The details are described in \ref selmethods_callbacks.
127 * Finally, there is a data structure that gives help texts for the method.
129 * The \c gmx_ana_selmethod_t variable should be declared as a global variable
130 * or it should be otherwise ensured that the structure is not freed: only a
131 * pointer to the structure is stored by the library.
134 * \section selmethods_params Defining parameters
136 * Parameters to selection methods are defined in a separate array of
137 * \c gmx_ana_selparam_t structures.
138 * The order of the parameters does not matter (except possibly for callback
139 * implementation), with one important exception:
140 * If the method evaluates to a \ref POS_VALUE, the first parameter should
141 * have \ref GROUP_VALUE and be the one that is used to calculate the
144 * An example parameter definition:
146 static gmx_ana_selparam_t sm_params_example[] = {
147 {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
148 {"from", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
152 * The first value gives the name of the parameter.
153 * The first parameter can have a NULL name, which means that the value should
154 * immediately follow the method name. This can be used to specify methods
155 * of the type 'within 5 of ...'.
157 * The second value specifies the type of the value that the parameter accepts.
158 * \ref NO_VALUE can be used to specify a boolean parameter, other possibilities
159 * are the same as for the selection method type.
161 * The third value gives the number of values that the parameter accepts.
162 * For boolean parameters (\ref NO_VALUE), it should be 0.
163 * For parameters with \ref SPAR_VARNUM of \ref SPAR_ATOMVAL, it should be set
164 * to -1 for consistency (it is not used).
165 * If \ref SPAR_RANGES is specified, it should be either 1 (to accept a single
166 * continuous range) or -1 (if combined with \ref SPAR_VARNUM).
167 * In all other cases, it should be a positive integer; in most cases, it
170 * The nest two pointers should always be NULL (they should be initialized in
171 * the callbacks), except the first pointer in the case of \ref SPAR_ENUMVAL
174 * The final value gives additional information about the acceptable values
175 * for the parameter using a combination of flags.
176 * The possible flags are:
177 * - \ref SPAR_OPTIONAL : If set, the user does not need to provide a value
178 * for the parameter. If not set, an error is reported if the parameter
179 * is not specified by the user.
180 * - \ref SPAR_DYNAMIC : If set, the method can handle dynamic values for
181 * the parameter, i.e., the value(s) can be given by an expression that
182 * evaluates to different values for different frames.
183 * - \ref SPAR_RANGES : Can be set only for \ref INT_VALUE and
184 * \ref REAL_VALUE parameters,
185 * and cannot be combined with \ref SPAR_DYNAMIC.
186 * If set, the parameter accepts ranges of values.
187 * The ranges are automatically sorted and compacted such that a minimum
188 * amount of non-overlapping ranges are given for the method.
189 * - \ref SPAR_VARNUM : If set, the parameter can have a variable number
190 * of values. These can be provided by the user as a list of values, or
191 * using a single \ref SMETH_VARNUMVAL (or a single \ref SMETH_SINGLEVAL)
193 * - \ref SPAR_ATOMVAL : If set, the parameter accepts either a single value
194 * or an expression that evaluates to a value for each input atom.
195 * The single input value is treated as if the same value was returned for
197 * Cannot be combined with \ref SPAR_RANGES or \ref SPAR_VARNUM.
198 * - \ref SPAR_ENUMVAL : Can only be set for \ref STR_VALUE parameters that
199 * take a single value, and cannot be combined with any other flag than
200 * \ref SPAR_OPTIONAL. If set, the parameter only accepts one of predefined
201 * string values. See \ref SPAR_ENUMVAL documentation for details on how
202 * to specify the acceptable values.
205 * \section selmethods_callbacks Implementing callbacks
207 * There are eight differen callback functions that can be implemented for
208 * selection methods: sel_datafunc(), sel_posfunc(), sel_initfunc(),
209 * sel_outinitfunc(), sel_freefunc(), sel_framefunc(), and two update functions.
210 * They are in this order in the \c gmx_ana_selmethod_t data structure.
211 * In general, any of the callbacks can be NULL, but the presence of
212 * parameters or other callbacks imposes some restrictions:
213 * - sel_datafunc() should be provided if the method takes parameters.
214 * - sel_initfunc() should be provided if the method takes
215 * any parameters with the \ref SPAR_VARNUM or \ref SPAR_ATOMVAL flags,
216 * except if those parameters have a \ref POS_VALUE.
217 * - sel_outinitfunc() should be provided for \ref POS_VALUE methods
218 * and \ref SMETH_VARNUMVAL methods.
219 * - sel_freefunc() should be provided if sel_datafunc() and/or
220 * sel_initfunc() allocate any dynamic memory in addition to the data
221 * structure itself (or allocates the data structure using some other means
223 * - sel_updatefunc_pos() only makes sense for methods with \ref SMETH_DYNAMIC
225 * - At least one update function should be provided unless the method type is
228 * The documentations for the function pointer types provide more information
229 * about how the callbacks should be implemented.
232 * \section selmethods_modifiers Selection modifiers
234 * Selection modifiers are a special kind of selection methods that can be
235 * appended to the end of a selection. They are specified by adding the
236 * \ref SMETH_MODIFIER flag to the \c gmx_ana_selmethod_t.
237 * They can have two different types:
238 * - \ref POS_VALUE : These modifiers are given the final positions
239 * as an input, and they can make modifications to the selection that are
240 * not possible otherwise (e.g., permute the atoms).
241 * The modifier should implement sel_updatefunc_pos() and also have
242 * one NULL parameter in the beginning of the parameter list that takes
243 * \ref POS_VALUE and is used to give the input positions.
244 * - \ref NO_VALUE : These modifiers do not modify the final selection, but
245 * can be used to implement per-selection options for analysis tools
246 * or to control the default behavior of the selection engine
247 * (currently, such a framework is not implemented, but should be easy to
248 * implement if required).
250 * In addition to restricting the type of the method, selection modifiers
251 * do not allow the flags \ref SMETH_SINGLEVAL and \ref SMETH_VARNUMVAL
252 * (they would not make sense).
254 * Parameters and callbacks should be implemented as with normal selection
255 * method, but beware that very little of the functionality has been tested.
258 * The modifier handling could be made more flexible and more generic;
259 * the current implementation does not allow many things which would be
260 * possible with slight changes in the internals of the library.
263 * \section selmethods_register Registering the method
265 * After defining the method with \c gmx_ana_selmethod_t, it should be
266 * registered with the selection engine.
267 * In analysis programs, this can be done by calling
268 * gmx_ana_selmethod_register().
269 * If adding the method to the library, you should add a pointer to the new
270 * method structure into the \c smtable_def array (in selmethod.cpp), and it is
271 * registered automatically.
272 * In both cases, gmx_ana_selmethod_register() does several checks on the
273 * structure and reports any errors or inconsistencies it finds.
276 * \brief API for handling selection methods.
278 * There should be no need to use the data structures or call the
279 * functions in this file directly unless implementing a custom selection
282 * Instructions for implementing custom selection methods can be found
283 * on a separate page: \ref page_module_selection_custom
285 * \author Teemu Murtola <teemu.murtola@cbr.su.se>
286 * \ingroup module_selection
288 #ifndef GMX_SELECTION_SELMETHOD_H
289 #define GMX_SELECTION_SELMETHOD_H
291 #include "../legacyheaders/typedefs.h"
293 #include "indexutil.h"
294 #include "selparam.h"
295 #include "selvalue.h"
299 class PositionCalculationCollection;
300 class SelectionParserSymbolTable;
303 struct gmx_ana_pos_t;
304 struct gmx_ana_selcollection_t;
306 /*! \name Selection method flags
307 * \anchor selmethod_flags
311 * If set, the method requires topology information.
313 #define SMETH_REQTOP 1
315 * If set, the method can only be evaluated dynamically.
317 #define SMETH_DYNAMIC 2
319 * If set, the method evaluates to a single value.
321 * The default is that the method evaluates to a value for each input atom.
322 * Cannot be combined with \ref SMETH_VARNUMVAL.
324 #define SMETH_SINGLEVAL 4
326 * If set, the method evaluates to an arbitrary number of values.
328 * The default is that the method evaluates to a value for each input atom.
329 * Cannot be combined with \ref SMETH_SINGLEVAL or with \ref GROUP_VALUE.
331 #define SMETH_VARNUMVAL 8
333 * If set, the method evaluates to single-character strings.
335 * This flag can only be set for \ref STR_VALUE methods. If it is set, the
336 * selection engine automatically allocates and frees the required strings.
337 * The evaluation function should store the character values as the first
338 * character in the strings in the output data structure and should not change
339 * the string pointers.
341 #define SMETH_CHARVAL 64
343 * If set, the method is a selection modifier.
345 * The method type should be \ref GROUP_VALUE or \ref NO_VALUE .
346 * Cannot be combined with \ref SMETH_SINGLEVAL or \ref SMETH_VARNUMVAL .
348 #define SMETH_MODIFIER 256
352 * Allocates and initializes internal data and parameter values.
354 * \param[in] npar Number of parameters in \p param.
355 * \param[in,out] param Pointer to (a copy of) the method's
356 * \c gmx_ana_selmethod_t::param.
357 * \returns Pointer to method-specific data structure.
358 * This pointer will be passed as the last parameter of all other function
360 * \throws unspecified Any errors should be indicated by throwing an
363 * Should allocate and initialize any internal data required by the method.
364 * Should also initialize the value pointers (\c gmx_ana_selparam_t::val) in
365 * \p param to point to variables within the internal data structure,
366 * with the exception of parameters that specify the \ref SPAR_VARNUM or
367 * the \ref SPAR_ATOMVAL flag (these should be handled in sel_initfunc()).
368 * However, parameters with a position value should be initialized.
369 * It is also possible to initialize \ref SPAR_ENUMVAL statically outside
370 * this function (see \ref SPAR_ENUMVAL).
371 * The \c gmx_ana_selparam_t::nvalptr should also be initialized for
372 * non-position-valued parameters that have both \ref SPAR_VARNUM and
373 * \ref SPAR_DYNAMIC set (it can also be initialized for other parameters if
374 * desired, but the same information will be available through other means).
375 * For optional parameters, the default values can (and should) be initialized
376 * here, as the parameter values are not changed if the parameter is not
379 * For boolean parameters (type equals \ref NO_VALUE), the default value
380 * should be set here. The user can override the value by giving the parameter
381 * either as 'NAME'/'noNAME', or as 'NAME on/off/yes/no'.
383 * If the method takes any parameters, this function must be provided.
385 typedef void *(*sel_datafunc)(int npar, gmx_ana_selparam_t *param);
387 * Sets the position calculation collection for the method.
389 * \param[in] pcc Position calculation collection that the method should use
390 * for position calculations.
391 * \param data Internal data structure from sel_datafunc().
393 * This function should be provided if the method uses the routines from
394 * poscalc.h for calculating positions.
395 * The pointer \p pcc should then be stored and used for initialization for
396 * any position calculation structures.
398 typedef void (*sel_posfunc)(gmx::PositionCalculationCollection *pcc, void *data);
400 * Does initialization based on topology and/or parameter values.
402 * \param[in] top Topology structure
403 * (can be NULL if \ref SMETH_REQTOP is not set).
404 * \param[in] npar Number of parameters in \p param.
405 * \param[in] param Pointer to (an initialized copy of) the method's
406 * \c gmx_ana_selmethod_t::param.
407 * \param data Internal data structure from sel_datafunc().
408 * \returns 0 on success, a non-zero error code on failure.
410 * This function is called after the parameters have been processed:
411 * the values of the parameters are stored at the locations set in
413 * The flags \ref SPAR_DYNAMIC and \ref SPAR_ATOMVAL are cleared before
414 * calling the function if the value is static or single-valued, respectively.
415 * If a parameter had the \ref SPAR_VARNUM or \ref SPAR_ATOMVAL flag (and
416 * is not \ref POS_VALUE), a pointer to the memory allocated for the values is
417 * found in \c gmx_ana_selparam_t::val.
418 * The pointer should be stored by this function, otherwise the values
419 * cannot be accessed.
420 * For \ref SPAR_VARNUM parameters, the number of values can be accessed
421 * through \c gmx_ana_selparam_t::val. For parameters with \ref SPAR_DYNAMIC,
422 * the number is the maximum number of values (the actual number can be
423 * accessed in sel_framefunc() and in the update callback through the value
424 * pointed by \c gmx_ana_selparam_t::nvalptr).
425 * For \ref SPAR_ATOMVAL parameters, \c gmx_ana_selparam_t::val::nr is set to
426 * 1 if a single value was provided, otherwise it is set to the maximum number
427 * of values possibly passed to the method.
428 * The value pointed by \c gmx_ana_selparam_t::nvalptr always contains the same
429 * value as \c gmx_ana_selparam_t::val::nr.
431 * For dynamic \ref GROUP_VALUE parameters (\ref SPAR_DYNAMIC set), the value
432 * will be the largest possible selection that may occur during the
433 * evaluation. For other types of dynamic parameters, the values are
436 * If the method takes any parameters with the \ref SPAR_VARNUM or
437 * \ref SPAR_ATOMVAL flags, this function must be provided, except if these
438 * parameters all have \ref POS_VALUE.
440 * This function may be called multiple times for the same method if the
441 * method takes parameters with \ref SPAR_ATOMVAL set.
443 typedef void (*sel_initfunc)(t_topology *top, int npar,
444 gmx_ana_selparam_t *param, void *data);
446 * Initializes output data structure.
448 * \param[in] top Topology structure
449 * (can be NULL if \ref SMETH_REQTOP is not set).
450 * \param[in,out] out Output data structure.
451 * \param[in] data Internal data structure from sel_datafunc().
452 * \returns 0 on success, an error code on error.
454 * This function is called immediately after sel_initfunc().
456 * If the method evaluates to a position (\ref POS_VALUE), this function
457 * should be provided, and it should initialize the \c gmx_ana_pos_t data
458 * structure pointed by \p out.p (the pointer is guaranteed to be non-NULL).
459 * The \p out.p->g pointer should be initialized to the group that is used
460 * to evaluate positions in sel_updatefunc() or sel_updatefunc_pos().
462 * The function should also be provided for non-position-valued
463 * \ref SMETH_VARNUMVAL methods. For these methods, it suffices to set the
464 * \p out->nr field to reflect the maximum number of values returned by the
467 * Currently, this function is not needed for other types of methods.
469 * This function may be called multiple times for the same method if the
470 * method takes parameters with \ref SPAR_ATOMVAL set.
472 typedef void (*sel_outinitfunc)(t_topology *top, gmx_ana_selvalue_t *out,
475 * Frees the internal data.
477 * \param[in] data Internal data structure from sel_datafunc().
479 * This function should be provided if the internal data structure contains
480 * dynamically allocated data, and should free any such data.
481 * The data structure itself should also be freed.
482 * For convenience, if there is no dynamically allocated data within the
483 * structure and the structure is allocated using malloc()/snew(), this
484 * function is not needed: the selection engine automatically frees the
485 * structure using sfree().
486 * Any memory pointers received as values of parameters are managed externally,
487 * and should not be freed.
488 * Pointers set as the value pointer of \ref SPAR_ENUMVAL parameters should not
491 typedef void (*sel_freefunc)(void *data);
494 * Initializes the evaluation for a new frame.
496 * \param[in] top Topology structure
497 * (can be NULL if \ref SMETH_REQTOP is not set).
498 * \param[in] fr Current frame.
499 * \param[in] pbc Initialized periodic boundary condition structure,
500 * or NULL if PBC should not be used.
501 * \param data Internal data structure from sel_datafunc().
502 * \returns 0 on success, a non-zero error code on failure.
504 * This function should be implemented if the selection method needs to
505 * do some preprocessing for each frame, and the preprocessing does not
506 * depend on the evaluation group.
507 * Because \p sel_updatefunc_* can be called more than once for a frame,
508 * it is inefficient do the preprocessing there.
509 * It is ensured that this function will be called before
510 * \p sel_updatefunc_* for each frame, and that it will be called at most
511 * once for each frame.
512 * For static methods, it is called once, with \p fr and \p pbc set to
515 typedef void (*sel_framefunc)(t_topology *top, t_trxframe *fr, t_pbc *pbc,
518 * Evaluates a selection method.
520 * \param[in] top Topology structure
521 * (can be NULL if \ref SMETH_REQTOP is not set).
522 * \param[in] fr Current frame.
523 * \param[in] pbc Initialized periodic boundary condition structure,
524 * or NULL if PBC should not be used.
525 * \param[in] g Index group for which the method should be evaluated.
526 * \param[out] out Output data structure.
527 * \param data Internal data structure from sel_datafunc().
528 * \returns 0 on success, a non-zero error code on error.
530 * This function should evaluate the method for each atom included in \p g,
531 * and write the output to \p out. The pointer in the union \p out->u that
532 * corresponds to the type of the method should be used.
533 * Enough memory has been allocated to store the output values.
534 * The number of values in \p out should also be updated if necessary.
535 * However, \ref POS_VALUE or \ref GROUP_VALUE methods should not touch
536 * \p out->nr (it should be 1 anyways).
538 * For \ref STR_VALUE methods, the pointers stored in \p out->s are discarded
539 * without freeing; it is the responsibility of this function to provide
540 * pointers that can be discarded without memory leaks.
542 typedef void (*sel_updatefunc)(t_topology *top, t_trxframe *fr, t_pbc *pbc,
543 gmx_ana_index_t *g, gmx_ana_selvalue_t *out,
546 * Evaluates a selection method using positions.
548 * \param[in] top Topology structure
549 * (can be NULL if \ref SMETH_REQTOP is not set).
550 * \param[in] fr Current frame.
551 * \param[in] pbc Initialized periodic boundary condition structure,
552 * or NULL if PBC should not be used.
553 * \param[in] pos Positions for which the method should be evaluated.
554 * \param[out] out Output data structure.
555 * \param data Internal data structure from sel_datafunc().
556 * \returns 0 on success, a non-zero error code on error.
558 * This function should evaluate the method for each position in \p g,
559 * and write the output values to \p out. The pointer in the union \p out->u
560 * that corresponds to the type of the method should be used.
561 * Enough memory has been allocated to store the output values.
562 * The number of values in \p out should also be updated if necessary.
563 * However, \ref POS_VALUE or \ref GROUP_VALUE methods should not touch
564 * \p out->nr (it should be 1 anyways).
566 * For \ref STR_VALUE methods, the pointers stored in \p out->s are discarded
567 * without freeing; it is the responsibility of this function to provide
568 * pointers that can be discarded without memory leaks.
570 typedef void (*sel_updatefunc_pos)(t_topology *top, t_trxframe *fr, t_pbc *pbc,
571 struct gmx_ana_pos_t *pos,
572 gmx_ana_selvalue_t *out,
576 * Help information for a selection method.
578 * If some information is not available, the corresponding field can be set to
581 typedef struct gmx_ana_selmethod_help_t
584 * One-line description of the syntax of the method.
586 * If NULL, the name of the method is used.
590 * Number of strings in \p help.
592 * Set to 0 if \p help is NULL.
596 * Detailed help for the method.
598 * If there is no help available in addition to \p syntax, this can be set
602 } gmx_ana_selmethod_help_t;
605 * Describes a selection method.
607 * Any of the function pointers except the update call can be NULL if the
608 * operation is not required or not supported. In this case,
609 * corresponding function calls are skipped.
611 * See the function pointer type documentation for details of how the
612 * functions should be implemented.
613 * More details on implementing new selection methods can be found on a
614 * separate page: \ref page_module_selection_custom.
616 typedef struct gmx_ana_selmethod_t
618 /** Name of the method. */
620 /** Type which the method returns. */
623 * Flags to specify how the method should be handled.
625 * See \ref selmethod_flags for allowed values.
628 /** Number of parameters the method takes. */
630 /** Pointer to the array of parameter descriptions. */
631 gmx_ana_selparam_t *param;
633 /** Function for allocating and initializing internal data and parameters. */
634 sel_datafunc init_data;
635 /** Function to set the position calculation collection. */
636 sel_posfunc set_poscoll;
637 /** Function to do initialization based on topology and/or parameter values. */
639 /** Function to initialize output data structure. */
640 sel_outinitfunc outinit;
641 /** Function to free the internal data. */
644 /** Function to initialize the calculation for a new frame. */
645 sel_framefunc init_frame;
646 /** Function to evaluate the value. */
647 sel_updatefunc update;
648 /** Function to evaluate the value using positions. */
649 sel_updatefunc_pos pupdate;
651 /** Help data for the method. */
652 gmx_ana_selmethod_help_t help;
653 } gmx_ana_selmethod_t;
655 /** Registers a selection method. */
657 gmx_ana_selmethod_register(gmx::SelectionParserSymbolTable *symtab,
658 const char *name, gmx_ana_selmethod_t *method);
659 /** Registers all selection methods in the library. */
661 gmx_ana_selmethod_register_defaults(gmx::SelectionParserSymbolTable *symtab);
663 /** Finds a parameter from a selection method by name. */
665 gmx_ana_selmethod_find_param(const char *name, gmx_ana_selmethod_t *method);