Better selection stdin handling.
[gromacs/qmmm-gamess-us.git] / src / gmxlib / selection / selcollection.h
bloba087f2ec2a3d1b81d9654d67635b61551d4f5be8
1 /*
3 * This source code is part of
5 * G R O M A C S
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 /*! \internal \file
32 * \brief Definition of \c gmx_ana_selcollection_t.
34 * This is an implementation header: there should be no need to use it outside
35 * this directory.
37 #ifndef SELECTION_COLLECTION_H
38 #define SELECTION_COLLECTION_H
40 #include <typedefs.h>
42 #include <indexutil.h>
44 /*! \internal
45 * \brief
46 * Information for a collection of selections.
48 * The functions to deal with the structure are defined in selection.h.
49 * The structure is allocated with gmx_ana_selcollection_create() and
50 * freed with gmx_ana_selcollection_free().
51 * Some default values must then be set with
52 * gmx_ana_selcollection_set_refpostype() and
53 * gmx_ana_selcollection_set_outpostype().
55 * After setting the default values, one or more selections can be parsed
56 * with gmx_ana_selcollection_parse_*().
57 * At latest at this point, the topology must be set with
58 * gmx_ana_selcollection_set_topology() unless
59 * gmx_ana_selcollection_requires_top() returns FALSE.
60 * Once all selections are parsed, they must be compiled all at once using
61 * gmx_ana_selcollection_compile().
62 * After these calls, gmx_ana_selcollection_get_count() and
63 * gmx_ana_selcollection_get_selections() can be used
64 * to get the compiled selections.
65 * gmx_ana_selcollection_evaluate() can be used to update the selections for a
66 * new frame.
67 * gmx_ana_selcollection_evaluate_fin() can be called after all the frames have
68 * been processed to restore the selection values back to the ones they were
69 * after gmx_ana_selcollection_compile(), i.e., dynamic selections have the
70 * maximal index group as their value.
72 * At any point, gmx_ana_selcollection_requires_top() can be called to see
73 * whether the information provided so far requires loading the topology.
74 * gmx_ana_selcollection_print_tree() can be used to print the internal
75 * representation of the selections (mostly useful for debugging).
77 struct gmx_ana_selcollection_t
79 /** Default reference position type for selections. */
80 const char *rpost;
81 /** Default output position type for selections. */
82 const char *spost;
83 /** TRUE if \ref POS_MASKONLY should be used for output position evaluation. */
84 bool bMaskOnly;
86 /** Root of the selection element tree. */
87 struct t_selelem *root;
88 /** Number of selections in \p sel. */
89 int nr;
90 /** Array of compiled selections. */
91 struct gmx_ana_selection_t **sel;
92 /** Number of variables defined. */
93 int nvars;
94 /** Selection strings for variables. */
95 char **varstrs;
97 /** Topology for the collection. */
98 t_topology *top;
99 /** Index group that contains all the atoms. */
100 struct gmx_ana_index_t gall;
101 /** Position calculation collection used for selection position evaluation. */
102 struct gmx_ana_poscalc_coll_t *pcc;
103 /** Parser symbol table. */
104 struct gmx_sel_symtab_t *symtab;
107 /** Clears the symbol table in the collection */
108 void
109 _gmx_selcollection_clear_symtab(struct gmx_ana_selcollection_t *sc);
111 #endif