+class IListIterator;
+
+//! Proxy object returned from IListIterator
+class IListProxy
+{
+public:
+ //! Default constructor.
+ IListProxy(const IListIterator* it) : it_(it) {}
+ //! Access current global atom number.
+ const InteractionLists& list() const;
+ //! Access current molecule.
+ int nmol() const;
+
+private:
+ const IListIterator* it_;
+};
+
+/*! \brief
+ * Object that allows looping over all atoms in an mtop.
+ */
+class IListIterator :
+ public boost::stl_interfaces::proxy_iterator_interface<IListIterator, std::forward_iterator_tag, InteractionLists, IListProxy>
+{
+ using Base =
+ boost::stl_interfaces::proxy_iterator_interface<IListIterator, std::forward_iterator_tag, InteractionLists, IListProxy>;
+
+public:
+ //! Construct from topology.
+ explicit IListIterator(const gmx_mtop_t& mtop, size_t mblock = 0);
+
+ //! Prefix increment.
+ IListIterator& operator++();
+ using Base:: operator++;
+
+ //! Equality comparison.
+ bool operator==(const IListIterator& o) const;
+
+ //! Dereference operator. Returns proxy.
+ IListProxy operator*() const { return { this }; }
+
+private:
+ //! Global topology.
+ const gmx_mtop_t* mtop_;
+ //! Index of molecule block corresponding to the current location.
+ size_t mblock_;
+
+ friend class IListProxy;
+};
+
+
+/*! \brief
+ * Range over all interaction lists of topology.
+ *
+ * Includes the intermolecular interactions as the final element in the
+ * range if present.
+ */
+class IListRange
+{
+public:
+ //! Default constructor.
+ explicit IListRange(const gmx_mtop_t& mtop);
+ //! Iterator to begin of range.
+ IListIterator& begin() { return begin_; }
+ //! Iterator to end of range.
+ IListIterator& end() { return end_; }
+
+private:
+ IListIterator begin_, end_;
+};
+