This file is indexed.

/usr/include/gromacs/selection/selectionoption.h is in libgromacs-dev 2016.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/*
 * This file is part of the GROMACS molecular simulation package.
 *
 * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 * and including many others, as listed in the AUTHORS file in the
 * top-level source directory and at http://www.gromacs.org.
 *
 * GROMACS is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * GROMACS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with GROMACS; if not, see
 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
 *
 * If you want to redistribute modifications to GROMACS, please
 * consider that scientific software is very special. Version
 * control is crucial - bugs must be traceable. We will be happy to
 * consider code for inclusion in the official distribution, but
 * derived work must not be called official GROMACS. Details are found
 * in the README & COPYING files - if they are missing, get the
 * official version at http://www.gromacs.org.
 *
 * To help us fund GROMACS development, we humbly ask that you cite
 * the research papers on the package. Check out http://www.gromacs.org.
 */
/*! \file
 * \brief
 * Declares gmx::SelectionOption and gmx::SelectionOptionInfo.
 *
 * \author Teemu Murtola <teemu.murtola@gmail.com>
 * \inpublicapi
 * \ingroup module_selection
 */
#ifndef GMX_SELECTION_SELECTIONOPTION_H
#define GMX_SELECTION_SELECTIONOPTION_H

#include "gromacs/options/abstractoption.h"
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionenums.h"

namespace gmx
{

class SelectionOptionInfo;
class SelectionOptionManager;
class SelectionOptionStorage;

/*! \brief
 * Specifies an option that provides selection(s).
 *
 * Public methods in this class do not throw.
 *
 * To use options of this type, SelectionOptionManager must first be added to
 * the Options collection.  For trajectory analysis tools, the framework takes
 * care of this.
 *
 * \todo
 * Support for specifying that an option accepts, e.g., two to four selections.
 * Currently, only a fixed count or any number of selections is possible.
 * \if internal
 * In addition to allowing this in OptionTemplate, also SelectionOptionManager
 * needs to be updated.
 * \endif
 *
 * \inpublicapi
 * \ingroup module_selection
 */
class SelectionOption : public OptionTemplate<Selection, SelectionOption>
{
    public:
        //! OptionInfo subclass corresponding to this option type.
        typedef SelectionOptionInfo InfoType;

        //! Initializes an option with the given name.
        explicit SelectionOption(const char *name)
            : MyBase(name), defaultText_(""),
              selectionFlags_(efSelection_DisallowEmpty)
        {
        }

        /*! \brief
         * Request velocity evaluation for output positions.
         *
         * \see Selection::setEvaluateVelocities()
         */
        MyClass &evaluateVelocities()
        { selectionFlags_.set(efSelection_EvaluateVelocities); return me(); }
        /*! \brief
         * Request force evaluation for output positions.
         *
         * \see Selection::setEvaluateForces()
         */
        MyClass &evaluateForces()
        { selectionFlags_.set(efSelection_EvaluateForces); return me(); }
        /*! \brief
         * Only accept selections that evaluate to atom positions.
         */
        MyClass &onlyAtoms()
        { selectionFlags_.set(efSelection_OnlyAtoms); return me(); }
        /*! \brief
         * Only accept selections that evaluate to atom positions in sorted order.
         */
        MyClass &onlySortedAtoms()
        {
            selectionFlags_.set(efSelection_OnlyAtoms);
            selectionFlags_.set(efSelection_OnlySorted);
            return me();
        }
        /*! \brief
         * Only accept static selections for this option.
         */
        MyClass &onlyStatic()
        { selectionFlags_.set(efSelection_OnlyStatic); return me(); }
        /*! \brief
         * Handle dynamic selections for this option with position masks.
         *
         * \see Selection
         * \see SelectionPosition::selected()
         */
        MyClass &dynamicMask()
        { selectionFlags_.set(efSelection_DynamicMask); return me(); }
        /*! \brief
         * Allow specifying an unconditionally empty selection for this option.
         *
         * If this option is not set, selections that are unconditionally empty
         * (i.e., can never match any atoms) result in errors.
         * Note that even without this option, it is still possible that a
         * dynamic selection evaluates to zero atoms for some frames.
         */
        MyClass &allowEmpty()
        { selectionFlags_.clear(efSelection_DisallowEmpty); return me(); }

        /*! \brief
         * Sets default selection text for the option.
         *
         * If the option is not set by the user, the provided text is parsed as
         * the value of the selection.
         */
        MyClass &defaultSelectionText(const char *text)
        { defaultText_ = text; return me(); }

    private:
        // Disable possibility to allow multiple occurrences, since it isn't
        // implemented.
        using MyBase::allowMultiple;
        // Disable default value because it is impossible to provide a
        // Selection object.
        using MyBase::defaultValue;
        using MyBase::defaultValueIfSet;

        virtual AbstractOptionStorage *createStorage(
            const OptionManagerContainer &managers) const;

        const char             *defaultText_;
        SelectionFlags          selectionFlags_;

        /*! \brief
         * Needed to initialize SelectionOptionStorage from this class without
         * otherwise unnecessary accessors.
         */
        friend class SelectionOptionStorage;
};

/*! \brief
 * Wrapper class for accessing and modifying selection option information.
 *
 * Allows changes to a selection option after creation.
 *
 * This class provides the necessary interface for changing, e.g., the number
 * of allowed selections for a selection option after the option has been
 * created with Options::addOption().  This is needed if the number or other
 * flags are only known after other options have been parsed.  The main
 * advantage of this class over custom checks is that if used before
 * interactive selection prompt, the interactive prompt is updated accordingly.
 *
 * When using this class, the option should be initially created with the most
 * permissive flags, and this class should be used to place restrictions where
 * appropriate.  Otherwise, values that are provided before adjustments will
 * need to follow the more strict checks.  In most cases in trajectory analysis
 * (which is the main use case for selection options), the adjustments should
 * be done in TrajectoryAnalysisModule::optionsFinished() for them to take
 * place before interactive selection prompts.
 *
 * An instance of this class for a selection option can be obtained with
 * SelectionOption::getAdjuster() when the option is created.
 *
 * Example use:
 * \code
   SelectionList sel;
   Options options("example", "Example options");
   SelectionOptionInfo *info;
   info = options.addOption(SelectionOption("sel").storeVector(&sel)
                                .multiValue());
   // < ... assign values to options ...>
   if ( condition )
   {
       // Put limitations on the selections based on the condition,
       // which can depend on other option values.
       // Throws if input given so far violates the limitations.
       info->setValueCount(2);
       info->setOnlyStatic(true);
   }
 * \endcode
 *
 * \inpublicapi
 * \ingroup module_selection
 */
class SelectionOptionInfo : public OptionInfo
{
    public:
        /*! \brief
         * Creates option info object for given storage object.
         *
         * Does not throw.
         */
        explicit SelectionOptionInfo(SelectionOptionStorage *option);

        /*! \brief
         * Sets the number of selections allowed for the option.
         *
         * \param[in] count  Number of allowed selections.
         * \throws    std::bad_alloc if out of memory.
         * \throws    InvalidInputError if values have already been provided
         *      and their count does not match.
         */
        void setValueCount(int count);

        /*! \brief
         * Sets whether this option evaluates velocities for positions.
         *
         * \param[in] bEnabled  If true, velocities are evaluated.
         *
         * Does not throw.
         *
         * \see Selection::setEvaluateVelocities()
         */
        void setEvaluateVelocities(bool bEnabled);
        /*! \brief
         * Sets whether this option evaluates forces for positions.
         *
         * \param[in] bEnabled  If true, forces are evaluated.
         *
         * Does not throw.
         *
         * \see Selection::setEvaluateForces()
         */
        void setEvaluateForces(bool bEnabled);
        /*! \brief
         * Sets whether this option accepts positions that come from multiple
         * atoms.
         *
         * \param[in] bEnabled  If true, the option accepts only positions that
         *      evaluate to atom positions.
         *
         * \see SelectionOption::onlyAtoms()
         */
        void setOnlyAtoms(bool bEnabled);
        /*! \brief
         * Sets whether this option accepts dynamic selections.
         *
         * \param[in] bEnabled  If true, the option accepts only static
         *      selections.
         * \throws    std::bad_alloc if out of memory.
         * \throws    InvalidInputError if dynamic selections have already been
         *      provided.
         *
         * Strong exception safety guarantee.
         *
         * \see SelectionOption::onlyStatic()
         */
        void setOnlyStatic(bool bEnabled);
        /*! \brief
         * Sets whether this option uses position masks for dynamic selections.
         *
         * \param[in] bEnabled  If true, the position masks are used.
         *
         * Does not throw.
         *
         * \see SelectionOption::dynamicMask()
         */
        void setDynamicMask(bool bEnabled);

    private:
        SelectionOptionStorage &option();
        const SelectionOptionStorage &option() const;
};

} // namespace gmx

#endif