Update instructions in containers.rst
[gromacs.git] / src / gromacs / trajectoryanalysis / runnercommon.h
blobbeb63214aa0168dac094317d64a20da502089a28
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2010,2011,2012,2013,2014 by the GROMACS development team.
5 * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
36 /*! \internal \file
37 * \brief
38 * Declares gmx::TrajectoryAnalysisRunnerCommon.
40 * \author Teemu Murtola <teemu.murtola@gmail.com>
41 * \ingroup module_trajectoryanalysis
43 #ifndef GMX_TRAJECTORYANALYSIS_RUNNERCOMMON_H
44 #define GMX_TRAJECTORYANALYSIS_RUNNERCOMMON_H
46 #include "gromacs/utility/classhelpers.h"
48 struct t_trxframe;
50 namespace gmx
53 class IOptionsContainer;
54 class ITopologyProvider;
55 class SelectionCollection;
56 class TimeUnitBehavior;
57 class TopologyInformation;
58 class TrajectoryAnalysisSettings;
60 /*! \internal
61 * \brief
62 * Implements common trajectory analysis runner functionality.
64 * As there is currently only one runner (TrajectoryAnalysisCommandLineRunner),
65 * the division of responsibilities is not yet very clear.
67 * \ingroup module_trajectoryanalysis
69 class TrajectoryAnalysisRunnerCommon
71 public:
72 /*! \brief
73 * Initializes a new runner helper.
75 * \param settings Settings object to use.
77 explicit TrajectoryAnalysisRunnerCommon(TrajectoryAnalysisSettings* settings);
78 ~TrajectoryAnalysisRunnerCommon();
80 //! Returns a topology provider for SelectionOptionBehavior.
81 ITopologyProvider* topologyProvider();
83 /*! \brief
84 * Initializes common options for trajectory analysis.
86 * \param[in,out] options Options object to add the options to.
87 * \param[in,out] timeUnitBehavior Time unit behavior to use for adding
88 * and handling the `-tu` option.
90 void initOptions(IOptionsContainer* options, TimeUnitBehavior* timeUnitBehavior);
91 //! Processes common option values after they have been parsed.
92 void optionsFinished();
93 //! Load topology information if provided and/or required.
94 void initTopology();
95 /*! \brief
96 * Reads the first frame from the trajectory.
98 * After this call, frame() returns the first frame.
100 void initFirstFrame();
101 /*! \brief
102 * Initializes the index in frame() that specifies the atoms contained.
104 * Can be called after selections have been compiled.
106 void initFrameIndexGroup();
107 /*! \brief
108 * Reads the next frame from the trajectory.
110 * \returns false if there were no more frames.
112 * After this call, frame() returns the newly loaded frame.
114 bool readNextFrame();
115 /*! \brief
116 * Performs common initialization for the currently loaded frame.
118 * Currently, makes molecules whole if requested.
120 void initFrame();
122 //! Returns true if input data comes from a trajectory.
123 bool hasTrajectory() const;
124 //! Returns the topology information object.
125 const TopologyInformation& topologyInformation() const;
126 //! Returns the currently loaded frame.
127 t_trxframe& frame() const;
129 private:
130 class Impl;
132 PrivateImplPointer<Impl> impl_;
135 } // namespace gmx
137 #endif