Split TopologyInformation into its own header
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 20 Jun 2018 07:38:40 +0000 (09:38 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 11 Jul 2018 17:08:21 +0000 (19:08 +0200)
This will help provide a useful upgrade path for tools to get away
from t_topology, and eventually into the new framework.

Introduced a builder function to fill TopologyInformation from a tpr
file, which will be needed shortly for porting old tools.

Refs #1862

Change-Id: If2594cdcd3f9817ff83e7fb73208cdb5c497bb1a

13 files changed:
src/gromacs/trajectoryanalysis/CMakeLists.txt
src/gromacs/trajectoryanalysis/analysissettings.cpp
src/gromacs/trajectoryanalysis/analysissettings.h
src/gromacs/trajectoryanalysis/cmdlinerunner.cpp
src/gromacs/trajectoryanalysis/modules/freevolume.cpp
src/gromacs/trajectoryanalysis/modules/pairdist.cpp
src/gromacs/trajectoryanalysis/modules/rdf.cpp
src/gromacs/trajectoryanalysis/modules/sasa.cpp
src/gromacs/trajectoryanalysis/modules/select.cpp
src/gromacs/trajectoryanalysis/runnercommon.cpp
src/gromacs/trajectoryanalysis/tests/cmdlinerunner.cpp
src/gromacs/trajectoryanalysis/topologyinformation.cpp [new file with mode: 0644]
src/gromacs/trajectoryanalysis/topologyinformation.h [new file with mode: 0644]

index 037a96483882f55f3808ff954141a62b14a69d46..86e61baab2843caaf1cde15834f068f6088caa42 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2010,2013,2014,2015,2018, 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.
@@ -39,6 +39,7 @@ gmx_install_headers(
     analysismodule.h
     analysissettings.h
     cmdlinerunner.h
+    topologyinformation.h
     )
 
 if (BUILD_TESTING)
index b6bb0d64db3c698afa8535af6b4289d466280f9c..3f6b2f8f7e10d2013572a3ddc18ebce1f5d1b5ad 100644 (file)
 
 #include "gromacs/commandline/cmdlineoptionsmodule.h"
 #include "gromacs/fileio/trxio.h"
-#include "gromacs/math/vec.h"
-#include "gromacs/topology/mtop_util.h"
-#include "gromacs/topology/topology.h"
 #include "gromacs/utility/arrayref.h"
-#include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/smalloc.h"
 
 #include "analysissettings-impl.h"
 
@@ -180,53 +175,4 @@ TrajectoryAnalysisSettings::setHelpText(const ArrayRef<const char *const> &help)
     impl_->optionsModuleSettings_->setHelpText(help);
 }
 
-
-/********************************************************************
- * TopologyInformation
- */
-
-TopologyInformation::TopologyInformation()
-    : mtop_(nullptr), top_(nullptr), bTop_(false), xtop_(nullptr), ePBC_(-1)
-{
-    clear_mat(boxtop_);
-}
-
-
-TopologyInformation::~TopologyInformation()
-{
-    done_top_mtop(top_, mtop_.get());
-    sfree(top_);
-    sfree(xtop_);
-}
-
-
-t_topology *TopologyInformation::topology() const
-{
-    if (top_ == nullptr && mtop_ != nullptr)
-    {
-        snew(top_, 1);
-        *top_ = gmx_mtop_t_to_t_topology(mtop_.get(), false);
-    }
-    return top_;
-}
-
-
-void
-TopologyInformation::getTopologyConf(rvec **x, matrix box) const
-{
-    if (box)
-    {
-        copy_mat(const_cast<rvec *>(boxtop_), box);
-    }
-    if (x)
-    {
-        if (!xtop_)
-        {
-            *x = nullptr;
-            GMX_THROW(APIError("Topology coordinates requested without setting efUseTopX"));
-        }
-        *x = xtop_;
-    }
-}
-
 } // namespace gmx
index cc7033c7c3280ce5df37be20cca78d8181a8b6b5..9d40901fb66a92e9e87e5bdf422fe23cea559f83 100644 (file)
@@ -34,7 +34,7 @@
  */
 /*! \file
  * \brief
- * Declares gmx::TrajectoryAnalysisSettings and gmx::TopologyInformation.
+ * Declares gmx::TrajectoryAnalysisSettings.
  *
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \inpublicapi
 
 #include <string>
 
-#include "gromacs/math/vectypes.h"
 #include "gromacs/options/timeunitmanager.h"
 #include "gromacs/utility/classhelpers.h"
 
-struct gmx_mtop_t;
-struct t_topology;
-
 namespace gmx
 {
 
@@ -236,75 +232,6 @@ class TrajectoryAnalysisSettings
         friend class TrajectoryAnalysisRunnerCommon;
 };
 
-/*! \brief
- * Topology information passed to a trajectory analysis module.
- *
- * This class is used to pass topology information to trajectory analysis
- * modules and to manage memory for them.  Having a single wrapper object
- * instead of passing each item separately makes TrajectoryAnalysisModule
- * interface simpler, and also reduces the need to change existing code if
- * additional information is added.
- *
- * Methods in this class do not throw if not explicitly stated.
- *
- * \inpublicapi
- * \ingroup module_trajectoryanalysis
- */
-class TopologyInformation
-{
-    public:
-        //! Returns true if a topology file was loaded.
-        bool hasTopology() const { return mtop_ != nullptr; }
-        //! Returns true if a full topology file was loaded.
-        bool hasFullTopology() const { return bTop_; }
-        //! Returns the loaded topology, or NULL if not loaded.
-        const gmx_mtop_t *mtop() const { return mtop_.get(); }
-        //! Returns the loaded topology, or NULL if not loaded.
-        t_topology *topology() const;
-        //! Returns the ePBC field from the topology.
-        int ePBC() const { return ePBC_; }
-        /*! \brief
-         * Gets the configuration from the topology.
-         *
-         * \param[out] x     Topology coordinate pointer to initialize.
-         *      (can be NULL, in which case it is not used).
-         * \param[out] box   Box size from the topology file
-         *      (can be NULL, in which case it is not used).
-         * \throws  APIError if topology coordinates are not available and
-         *      \p x is not NULL.
-         *
-         * If TrajectoryAnalysisSettings::efUseTopX has not been specified,
-         * \p x should be NULL.
-         *
-         * The pointer returned in \p *x should not be freed.
-         */
-        void getTopologyConf(rvec **x, matrix box) const;
-
-    private:
-        TopologyInformation();
-        ~TopologyInformation();
-
-        std::unique_ptr<gmx_mtop_t> mtop_;
-        //! The topology structure, or NULL if no topology loaded.
-        // TODO: Replace fully with mtop.
-        mutable t_topology  *top_;
-        //! true if full tpx file was loaded, false otherwise.
-        bool                 bTop_;
-        //! Coordinates from the topology (can be NULL).
-        rvec                *xtop_;
-        //! The box loaded from the topology file.
-        matrix               boxtop_;
-        //! The ePBC field loaded from the topology file.
-        int                  ePBC_;
-
-        GMX_DISALLOW_COPY_AND_ASSIGN(TopologyInformation);
-
-        /*! \brief
-         * Needed to initialize the data.
-         */
-        friend class TrajectoryAnalysisRunnerCommon;
-};
-
 } // namespace gmx
 
 #endif
index 239bffc799ec36d8db70e0e2d7c487ca0117d194..4b93e7c42fca77e5cd39bdda78b7f55139b59475 100644 (file)
@@ -54,6 +54,7 @@
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysismodule.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/filestream.h"
 #include "gromacs/utility/gmxassert.h"
index 04561e89e2a09b6f15b96052f9c738be1f1fa695..ed54bd60ec26b4a2e2348d88a750bd8f22c49a42 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
@@ -64,6 +64,7 @@
 #include "gromacs/topology/topology.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/pleasecite.h"
index 72f7417944a668ea8f288687e54a364af529ae7b..843e36655bc194955223092affae27203d664596 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2018, 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.
@@ -60,6 +60,7 @@
 #include "gromacs/selection/selectionoption.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/stringutil.h"
index 664682e0abeaecb92e262eef4ac6f76b5a7369e4..45079fc98f1fd9c0657d87b4a480b21c664f9733 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, 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.
@@ -70,6 +70,7 @@
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysismodule.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/stringutil.h"
 
index cad893791f292c85947441befc75571f5c6e1805..4e16edf92875f3f7a8bf3ecb6d7ad97da65d17bb 100644 (file)
@@ -68,6 +68,7 @@
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysismodule.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/pleasecite.h"
index 3063708ca781923f28ce57e1ef460582ddfc5aef..15810ffa18251dcef9150a08a2d69644553732e9 100644 (file)
@@ -67,6 +67,7 @@
 #include "gromacs/topology/topology.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
index 59ca34b8559962fa2366cf05616db46cdeb38532..4ba187e4ad8a5aa323938474fe1a85089fbb1bc3 100644 (file)
@@ -48,8 +48,6 @@
 #include <algorithm>
 #include <string>
 
-#include "gromacs/compat/make_unique.h"
-#include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/oenv.h"
 #include "gromacs/fileio/timecontrol.h"
 #include "gromacs/fileio/trxio.h"
@@ -65,6 +63,7 @@
 #include "gromacs/topology/topology.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
@@ -181,20 +180,7 @@ TrajectoryAnalysisRunnerCommon::Impl::initTopology(bool required)
     // Load the topology if requested.
     if (!topfile_.empty())
     {
-        topInfo_.mtop_ = gmx::compat::make_unique<gmx_mtop_t>();
-        readConfAndTopology(topfile_.c_str(), &topInfo_.bTop_, topInfo_.mtop_.get(),
-                            &topInfo_.ePBC_, &topInfo_.xtop_, nullptr,
-                            topInfo_.boxtop_);
-        // TODO: Only load this here if the tool actually needs it; selections
-        // take care of themselves.
-        for (gmx_moltype_t &moltype : topInfo_.mtop_->moltype)
-        {
-            if (!moltype.atoms.haveMass)
-            {
-                // Try to read masses from database, be silent about missing masses
-                atomsSetMassesBasedOnNames(&moltype.atoms, FALSE);
-            }
-        }
+        topInfo_.fillFromInputFile(topfile_);
         if (hasTrajectory()
             && !settings_.hasFlag(TrajectoryAnalysisSettings::efUseTopX))
         {
index 221651b7f488550a7a4f138861566a7478a6fb14..6dfefd8c2c4d268be0c2384fffd6131a58e09afd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, 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.
@@ -53,6 +53,7 @@
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/trajectoryanalysis/analysismodule.h"
 #include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/trajectoryanalysis/topologyinformation.h"
 #include "gromacs/utility/exceptions.h"
 
 #include "testutils/cmdlinetest.h"
diff --git a/src/gromacs/trajectoryanalysis/topologyinformation.cpp b/src/gromacs/trajectoryanalysis/topologyinformation.cpp
new file mode 100644 (file)
index 0000000..482cda7
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018, 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.
+ */
+/*! \internal \file
+ * \brief
+ * Implements classes in topologyinformation.h.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \ingroup module_trajectoryanalysis
+ */
+#include "gmxpre.h"
+
+#include "topologyinformation.h"
+
+#include "gromacs/compat/make_unique.h"
+#include "gromacs/fileio/confio.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/topology/topology.h"
+#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/smalloc.h"
+
+namespace gmx
+{
+
+TopologyInformation::TopologyInformation()
+    : mtop_(nullptr), top_(nullptr), bTop_(false), xtop_(nullptr), ePBC_(-1)
+{
+    clear_mat(boxtop_);
+}
+
+
+TopologyInformation::~TopologyInformation()
+{
+    done_top_mtop(top_, mtop_.get());
+    sfree(top_);
+    sfree(xtop_);
+}
+
+
+t_topology *TopologyInformation::topology() const
+{
+    if (top_ == nullptr && mtop_ != nullptr)
+    {
+        snew(top_, 1);
+        *top_ = gmx_mtop_t_to_t_topology(mtop_.get(), false);
+    }
+    return top_;
+}
+
+void TopologyInformation::fillFromInputFile(const std::string &filename)
+{
+    mtop_ = gmx::compat::make_unique<gmx_mtop_t>();
+    readConfAndTopology(filename.c_str(), &bTop_, mtop_.get(),
+                        &ePBC_, &xtop_, nullptr,
+                        boxtop_);
+    // TODO: Only load this here if the tool actually needs it; selections
+    // take care of themselves.
+    for (gmx_moltype_t &moltype : mtop_->moltype)
+    {
+        if (!moltype.atoms.haveMass)
+        {
+            // Try to read masses from database, be silent about missing masses
+            atomsSetMassesBasedOnNames(&moltype.atoms, FALSE);
+        }
+    }
+}
+
+void
+TopologyInformation::getTopologyConf(rvec **x, matrix box) const
+{
+    if (box)
+    {
+        copy_mat(const_cast<rvec *>(boxtop_), box);
+    }
+    if (x)
+    {
+        if (!xtop_)
+        {
+            *x = nullptr;
+            GMX_THROW(APIError("Topology coordinates requested without setting efUseTopX"));
+        }
+        *x = xtop_;
+    }
+}
+
+} // namespace gmx
diff --git a/src/gromacs/trajectoryanalysis/topologyinformation.h b/src/gromacs/trajectoryanalysis/topologyinformation.h
new file mode 100644 (file)
index 0000000..30510af
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2018, 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::TopologyInformation.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \inlibraryapi
+ * \ingroup module_trajectoryanalysis
+ */
+#ifndef GMX_TRAJECTORYANALYSIS_TOPOLOGYINFORMATION_H
+#define GMX_TRAJECTORYANALYSIS_TOPOLOGYINFORMATION_H
+
+#include <string>
+
+#include "gromacs/math/vectypes.h"
+#include "gromacs/utility/classhelpers.h"
+
+struct gmx_mtop_t;
+struct t_topology;
+
+namespace gmx
+{
+
+class TopologyInformation;
+class TrajectoryAnalysisRunnerCommon;
+
+/*! \libinternal
+ * \brief Topology information passed to a trajectory analysis module.
+ *
+ * This class is used to pass topology information to trajectory analysis
+ * modules and to manage memory for them.  Having a single wrapper object
+ * instead of passing each item separately makes TrajectoryAnalysisModule
+ * interface simpler, and also reduces the need to change existing code if
+ * additional information is added.
+ *
+ * It is intended that eventually most clients of this class will be
+ * analysis tools ported to the new analysis framework, but we will
+ * use this infrastructure also from the legacy analysis tools during
+ * the transition period. That will make it easier to put those tools
+ * under tests, and eventually port them.
+ *
+ * Methods in this class do not throw if not explicitly stated.
+ *
+ * \ingroup module_trajectoryanalysis
+ */
+class TopologyInformation
+{
+    public:
+        //! Returns true if a topology file was loaded.
+        bool hasTopology() const { return mtop_ != nullptr; }
+        //! Returns true if a full topology file was loaded.
+        bool hasFullTopology() const { return bTop_; }
+        /*! \brief Builder function to fill the contents of
+         * TopologyInformation in \c topInfo from \c filename.
+         *
+         * Different tools require, might need, would benefit from, or
+         * do not need topology information. This functions implements
+         * the two-phase construction that is currently needed to
+         * support that. */
+        void fillFromInputFile(const std::string &filename);
+        //! Returns the loaded topology, or NULL if not loaded.
+        const gmx_mtop_t *mtop() const { return mtop_.get(); }
+        //! Returns the loaded topology, or NULL if not loaded.
+        t_topology *topology() const;
+        //! Returns the ePBC field from the topology.
+        int ePBC() const { return ePBC_; }
+        /*! \brief
+         * Gets the configuration from the topology.
+         *
+         * \param[out] x     Topology coordinate pointer to initialize.
+         *      (can be NULL, in which case it is not used).
+         * \param[out] box   Box size from the topology file
+         *      (can be NULL, in which case it is not used).
+         * \throws  APIError if topology coordinates are not available and
+         *      \p x is not NULL.
+         *
+         * If TrajectoryAnalysisSettings::efUseTopX has not been specified,
+         * \p x should be NULL.
+         *
+         * The pointer returned in \p *x should not be freed.
+         */
+        void getTopologyConf(rvec **x, matrix box) const;
+
+    private:
+        TopologyInformation();
+        ~TopologyInformation();
+
+        std::unique_ptr<gmx_mtop_t> mtop_;
+        //! The topology structure, or NULL if no topology loaded.
+        // TODO: Replace fully with mtop.
+        mutable t_topology  *top_;
+        //! true if full tpx file was loaded, false otherwise.
+        bool                 bTop_;
+        //! Coordinates from the topology (can be NULL).
+        rvec                *xtop_;
+        //! The box loaded from the topology file.
+        matrix               boxtop_;
+        //! The ePBC field loaded from the topology file.
+        int                  ePBC_;
+
+        GMX_DISALLOW_COPY_AND_ASSIGN(TopologyInformation);
+
+        /*! \brief
+         * Needed to initialize the data.
+         */
+        friend class TrajectoryAnalysisRunnerCommon;
+};
+
+} // namespace gmx
+
+#endif