Better averaging for analysis data modules.
authorTeemu Murtola <teemu.murtola@gmail.com>
Wed, 3 Apr 2013 17:17:12 +0000 (20:17 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 12 Jun 2013 05:30:46 +0000 (07:30 +0200)
Added an AnalysisDataFrameAverager for functionality common to analysis
data modules that compute averages over frames.  Currently, it only
accumulates the average and variance in double precision (using better
formula than before), but provides a useful base for implementing other
functionality:
 - Block averaging or other methods of better estimating the error.
 - Parallelization support to allow these modules to work in parallel
   after #869 is implemented.
For all of these, after the implementation is done in this common class,
it is easy to have that functionality in all the modules.  Some
interface changes may be required for some of the above, though.

Also some improvements to AnalysisDataAverageModule documentation.

Change-Id: I06ae7a92d36a0ee7e2fc0a1602ac40e6b8212d1d

21 files changed:
src/gromacs/analysisdata/modules/average.cpp
src/gromacs/analysisdata/modules/average.h
src/gromacs/analysisdata/modules/frameaverager.cpp [new file with mode: 0644]
src/gromacs/analysisdata/modules/frameaverager.h [new file with mode: 0644]
src/gromacs/analysisdata/modules/histogram.cpp
src/gromacs/analysisdata/modules/histogram.h
src/gromacs/analysisdata/tests/refdata/AverageModuleTest_BasicTest.xml
src/gromacs/analysisdata/tests/refdata/AverageModuleTest_CanCustomizeXAxis.xml
src/gromacs/analysisdata/tests/refdata/AverageModuleTest_HandlesMultipointData.xml
src/gromacs/analysisdata/tests/refdata/BinAverageModuleTest_ComputesCorrectly.xml
src/gromacs/analysisdata/tests/refdata/BinAverageModuleTest_ComputesCorrectlyWithAll.xml
src/gromacs/analysisdata/tests/refdata/SimpleHistogramModuleTest_ComputesCorrectly.xml
src/gromacs/analysisdata/tests/refdata/SimpleHistogramModuleTest_ComputesCorrectlyWithAll.xml
src/gromacs/analysisdata/tests/refdata/WeightedHistogramModuleTest_ComputesCorrectly.xml
src/gromacs/analysisdata/tests/refdata/WeightedHistogramModuleTest_ComputesCorrectlyWithAll.xml
src/gromacs/trajectoryanalysis/tests/refdata/AngleModuleTest_ComputesVectorTimeZeroAngles.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_BasicTest.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesMaxPDBOutput.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesPDBOutputWithNonPDBInput.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesPDBOutputWithPDBInput.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesSelectedPDBOutput.xml

index 6aea89c000f0bc747f45f9edb0599eca176eb96f..9640b224a98f6061836e5e8f4979e0652eba0019 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
  * others, as listed in the AUTHORS file in the top-level source
  * directory and at http://www.gromacs.org.
@@ -46,6 +46,8 @@
 #include "gromacs/analysisdata/dataframe.h"
 #include "gromacs/analysisdata/datastorage.h"
 
+#include "frameaverager.h"
+
 namespace gmx
 {
 
@@ -53,7 +55,15 @@ namespace gmx
  * AnalysisDataAverageModule
  */
 
+class AnalysisDataAverageModule::Impl
+{
+    public:
+        //! Averaging helper object.
+        AnalysisDataFrameAverager averager_;
+};
+
 AnalysisDataAverageModule::AnalysisDataAverageModule()
+    : impl_(new Impl())
 {
     setColumnCount(2);
 }
@@ -71,10 +81,9 @@ AnalysisDataAverageModule::flags() const
 void
 AnalysisDataAverageModule::dataStarted(AbstractAnalysisData *data)
 {
-    int nrows = data->columnCount();
-    setRowCount(nrows);
-    allocateValues();
-    nsamples_.resize(nrows);
+    const int valueCount = data->columnCount();
+    impl_->averager_.setColumnCount(valueCount);
+    setRowCount(valueCount);
 }
 
 void
@@ -85,17 +94,7 @@ AnalysisDataAverageModule::frameStarted(const AnalysisDataFrameHeader & /*header
 void
 AnalysisDataAverageModule::pointsAdded(const AnalysisDataPointSetRef &points)
 {
-    int firstcol = points.firstColumn();
-    for (int i = 0; i < points.columnCount(); ++i)
-    {
-        if (points.present(i))
-        {
-            real y = points.y(i);
-            value(firstcol + i, 0)  += y;
-            value(firstcol + i, 1)  += y * y;
-            nsamples_[firstcol + i] += 1;
-        }
-    }
+    impl_->averager_.addPoints(points);
 }
 
 void
@@ -106,12 +105,12 @@ AnalysisDataAverageModule::frameFinished(const AnalysisDataFrameHeader & /*heade
 void
 AnalysisDataAverageModule::dataFinished()
 {
+    impl_->averager_.finish();
+    allocateValues();
     for (int i = 0; i < rowCount(); ++i)
     {
-        real ave = value(i, 0) / nsamples_[i];
-        real std = sqrt(value(i, 1) / nsamples_[i] - ave * ave);
-        setValue(i, 0, ave);
-        setValue(i, 1, std);
+        setValue(i, 0, impl_->averager_.average(i));
+        setValue(i, 1, sqrt(impl_->averager_.variance(i)));
     }
     valuesReady();
 }
index 71398db5c981b6bd9f5f0329df8f9f6454d6d1ac..999fb01f99a6699e2ce0a2a7714ef17522b6bc82 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
  * others, as listed in the AUTHORS file in the top-level source
  * directory and at http://www.gromacs.org.
@@ -54,16 +54,22 @@ namespace gmx
 {
 
 /*! \brief
- * Data module for simple averaging of columns.
+ * Data module for independently averaging each column in input data.
  *
- * Output data contains a frame for each column of input data.
- * There are two columns: the average and standard deviation of
- * that column.
- * The data becomes available only after the original data has been
- * finished.
+ * Computes the average and standard deviation independently for each column in
+ * the input data.  Multipoint data and missing data points are both supported.
+ * The average is always calculated over all frames and data points for a
+ * column.
  *
- * Multipoint data and missing data points are both supported. The average
- * is always calculated over all data points present in a column.
+ * Output data contains a frame for each column in the input data.
+ * The first column of each output frame is the average of the corresponding
+ * input column.  The second output column is the standard deviation of the
+ * corresponding input column.
+ * average() and stddev() methods are also provided for convenient access to
+ * these properties.
+ *
+ * The output data becomes available only after the input data has been
+ * finished.
  *
  * \inpublicapi
  * \ingroup module_analysisdata
@@ -91,9 +97,9 @@ class AnalysisDataAverageModule : public AbstractAnalysisArrayData,
         real stddev(int index) const;
 
     private:
-        std::vector<int>        nsamples_;
+        class Impl;
 
-        // Copy and assign disallowed by base.
+        PrivateImplPointer<Impl> impl_;
 };
 
 //! Smart pointer to manage an AnalysisDataAverageModule object.
diff --git a/src/gromacs/analysisdata/modules/frameaverager.cpp b/src/gromacs/analysisdata/modules/frameaverager.cpp
new file mode 100644 (file)
index 0000000..f79b7ed
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2013, by the GROMACS development team, led by
+ * David van der Spoel, Berk Hess, 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 gmx::AnalysisDataFrameAverager.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \ingroup module_analysisdata
+ */
+#include "frameaverager.h"
+
+#include "gromacs/analysisdata/dataframe.h"
+#include "gromacs/utility/gmxassert.h"
+
+namespace gmx
+{
+
+void AnalysisDataFrameAverager::setColumnCount(int columnCount)
+{
+    GMX_RELEASE_ASSERT(columnCount >= 0, "Invalid column count");
+    GMX_RELEASE_ASSERT(values_.empty(),
+                       "Cannot initialize multiple times");
+    values_.resize(columnCount);
+}
+
+void AnalysisDataFrameAverager::addValue(int index, real value)
+{
+    AverageItem &item  = values_[index];
+    const double delta = value - item.average;
+    item.samples    += 1;
+    item.average    += delta / item.samples;
+    item.squaredSum += delta * (value - item.average);
+}
+
+void AnalysisDataFrameAverager::addPoints(const AnalysisDataPointSetRef &points)
+{
+    const int firstColumn = points.firstColumn();
+    GMX_ASSERT(static_cast<size_t>(firstColumn + points.columnCount()) <= values_.size(),
+               "Initialized with too few columns");
+    for (int i = 0; i < points.columnCount(); ++i)
+    {
+        if (points.present(i))
+        {
+            addValue(firstColumn + i, points.y(i));
+        }
+    }
+
+}
+
+void AnalysisDataFrameAverager::finish()
+{
+    bFinished_ = true;
+}
+
+} // namespace gmx
diff --git a/src/gromacs/analysisdata/modules/frameaverager.h b/src/gromacs/analysisdata/modules/frameaverager.h
new file mode 100644 (file)
index 0000000..54c8504
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2013, by the GROMACS development team, led by
+ * David van der Spoel, Berk Hess, 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
+ * Declares gmx::AnalysisDataFrameAverager.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
+ * \ingroup module_analysisdata
+ */
+#ifndef GMX_ANALYSISDATA_MODULES_FRAMEAVERAGER_H
+#define GMX_ANALYSISDATA_MODULES_FRAMEAVERAGER_H
+
+#include <vector>
+
+#include "../../legacyheaders/types/simple.h"
+
+#include "../../utility/gmxassert.h"
+
+namespace gmx
+{
+
+class AnalysisDataPointSetRef;
+
+/*! \internal \brief
+ * Helper class for modules that average values over frames.
+ *
+ * This class implements common functionality for analysis data modules that
+ * need to average a set of values over frames.  Currently, it is designed for
+ * computing averages for each input column independently, but should be
+ * relatively easy to make more general if required.
+ *
+ * This class takes care of accumulating the values and computing their
+ * variance.  It allows different number of samples for each input column.
+ * Accumulation is always in double precision and uses a formula that is
+ * relatively stable numerically.  For now, does nothing fancy,
+ * but provides ground for other implementation (e.g., related to
+ * parallelization) that would benefit all such modules.
+ *
+ * Methods in this class do not throw unless otherwise indicated.
+ *
+ * \ingroup module_analysisdata
+ */
+class AnalysisDataFrameAverager
+{
+    public:
+        AnalysisDataFrameAverager() : bFinished_(false) {}
+
+        /*! \brief
+         * Sets the number of columns in the input data.
+         *
+         * \throws std::bad_alloc if out of memory.
+         *
+         * Typically called from AnalysisDataModuleInterface::dataStarted().
+         *
+         * Must be called exactly once, before setting calling any other method
+         * in the class.
+         */
+        void setColumnCount(int columnCount);
+        /*! \brief
+         * Adds a single value to the average for a given column.
+         *
+         * \param[in] index  Index of the column to add the value to.
+         * \param[in] value  Value to add to the sample.
+         */
+        void addValue(int index, real value);
+        /*! \brief
+         * Accumulates data from a given point set into the average.
+         *
+         * Typically called from AnalysisDataModuleInterface::pointsAdded().
+         *
+         * Each call accumulates the values for those columns that are present
+         * in the point set.  Can be called multiple times for a frame, and
+         * does not need to be called for every frame.
+         */
+        void addPoints(const AnalysisDataPointSetRef &points);
+        /*! \brief
+         * Finalizes the calculation of the averages and variances.
+         *
+         * Does any computation that is not done during the accumulation in
+         * addPoints().  Currently, does nothing, but provided as a placeholder
+         * for more complex implementation.
+         *
+         * Typically called from AnalysisDataModuleInterface::dataFinished().
+         */
+        void finish();
+
+        /*! \brief
+         * Returns the computed average for a given column.
+         *
+         * If called before finish(), the results are undefined.
+         */
+        real average(int index) const
+        {
+            GMX_ASSERT(index >= 0 && index <= static_cast<int>(values_.size()),
+                       "Invalid column index");
+            GMX_ASSERT(bFinished_,
+                       "Values available only after finished() has been called");
+            return values_[index].average;
+        }
+        /*! \brief
+         * Returns the computed (sample) variance for a given column.
+         *
+         * If called before finish(), the results are undefined.
+         */
+        real variance(int index) const
+        {
+            GMX_ASSERT(index >= 0 && index <= static_cast<int>(values_.size()),
+                       "Invalid column index");
+            GMX_ASSERT(bFinished_,
+                       "Values available only after finished() has been called");
+            const AverageItem &item = values_[index];
+            return item.samples > 1 ? item.squaredSum / (item.samples - 1) : 0.0;
+        }
+        /*! \brief
+         * Returns the number of samples for a given column.
+         *
+         * If called before finish(), the results are undefined.
+         */
+        int sampleCount(int index) const
+        {
+            GMX_ASSERT(index >= 0 && index <= static_cast<int>(values_.size()),
+                       "Invalid column index");
+            GMX_ASSERT(bFinished_,
+                       "Values available only after finished() has been called");
+            return values_[index].samples;
+        }
+
+    private:
+        struct AverageItem
+        {
+            AverageItem() : average(0.0), squaredSum(0.0), samples(0) {}
+
+            //! Average of the values so far.
+            double               average;
+            //! Sum of squared deviations from the average for values so far.
+            double               squaredSum;
+            //! Number of values so far.
+            int                  samples;
+        };
+
+        std::vector<AverageItem> values_;
+        bool                     bFinished_;
+};
+
+} // namespace gmx
+
+#endif
index 5425b5dfd3d765044a22a158544a1d0b6ace875b..766ce363f8ea4258fc7e0af0564b642b8cce3881 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
  * others, as listed in the AUTHORS file in the top-level source
  * directory and at http://www.gromacs.org.
@@ -50,6 +50,8 @@
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
 
+#include "frameaverager.h"
+
 namespace
 {
 
@@ -403,14 +405,13 @@ class BasicAverageHistogramModule : public AbstractAverageHistogram,
         virtual void dataFinished();
 
     private:
-        //! Number of frames accumulated so far.
-        int                     frameCount_;
+        //! Averaging helper object.
+        AnalysisDataFrameAverager averager_;
 
         // Copy and assign disallowed by base.
 };
 
 BasicAverageHistogramModule::BasicAverageHistogramModule()
-    : frameCount_(0)
 {
     setColumnCount(2);
 }
@@ -418,7 +419,7 @@ BasicAverageHistogramModule::BasicAverageHistogramModule()
 
 BasicAverageHistogramModule::BasicAverageHistogramModule(
         const AnalysisHistogramSettings &settings)
-    : AbstractAverageHistogram(settings), frameCount_(0)
+    : AbstractAverageHistogram(settings)
 {
     setColumnCount(2);
 }
@@ -436,7 +437,7 @@ BasicAverageHistogramModule::dataStarted(AbstractAnalysisData *data)
 {
     GMX_RELEASE_ASSERT(rowCount() == data->columnCount(),
                        "Inconsistent data sizes, something is wrong in the initialization");
-    allocateValues();
+    averager_.setColumnCount(rowCount());
 }
 
 
@@ -449,32 +450,25 @@ BasicAverageHistogramModule::frameStarted(const AnalysisDataFrameHeader & /*head
 void
 BasicAverageHistogramModule::pointsAdded(const AnalysisDataPointSetRef &points)
 {
-    int firstcol = points.firstColumn();
-    for (int i = 0; i < points.columnCount(); ++i)
-    {
-        real y = points.y(i);
-        value(firstcol + i, 0) += y;
-        value(firstcol + i, 1) += y * y;
-    }
+    averager_.addPoints(points);
 }
 
 
 void
 BasicAverageHistogramModule::frameFinished(const AnalysisDataFrameHeader & /*header*/)
 {
-    ++frameCount_;
 }
 
 
 void
 BasicAverageHistogramModule::dataFinished()
 {
+    averager_.finish();
+    allocateValues();
     for (int i = 0; i < rowCount(); ++i)
     {
-        real ave = value(i, 0) / frameCount_;
-        real std = sqrt(value(i, 1) / frameCount_ - ave * ave);
-        setValue(i, 0, ave);
-        setValue(i, 1, std);
+        setValue(i, 0, averager_.average(i));
+        setValue(i, 1, sqrt(averager_.variance(i)));
     }
 }
 
@@ -784,7 +778,23 @@ AnalysisDataWeightedHistogramModule::requestStorageInternal(int nframes)
  * AnalysisDataBinAverageModule
  */
 
+class AnalysisDataBinAverageModule::Impl
+{
+    public:
+        Impl() {}
+        explicit Impl(const AnalysisHistogramSettings &settings)
+            : settings_(settings)
+        {
+        }
+
+        //! Histogram settings.
+        AnalysisHistogramSettings  settings_;
+        //! Averaging helper object.
+        AnalysisDataFrameAverager  averager_;
+};
+
 AnalysisDataBinAverageModule::AnalysisDataBinAverageModule()
+    : impl_(new Impl())
 {
     setColumnCount(3);
 }
@@ -792,7 +802,7 @@ AnalysisDataBinAverageModule::AnalysisDataBinAverageModule()
 
 AnalysisDataBinAverageModule::AnalysisDataBinAverageModule(
         const AnalysisHistogramSettings &settings)
-    : settings_(settings)
+    : impl_(new Impl(settings))
 {
     setColumnCount(3);
     setRowCount(settings.binCount());
@@ -809,13 +819,20 @@ AnalysisDataBinAverageModule::~AnalysisDataBinAverageModule()
 void
 AnalysisDataBinAverageModule::init(const AnalysisHistogramSettings &settings)
 {
-    settings_ = settings;
+    impl_->settings_ = settings;
     setRowCount(settings.binCount());
     setXAxis(settings.firstEdge() + 0.5 * settings.binWidth(),
              settings.binWidth());
 }
 
 
+const AnalysisHistogramSettings &
+AnalysisDataBinAverageModule::settings() const
+{
+    return impl_->settings_;
+}
+
+
 int
 AnalysisDataBinAverageModule::flags() const
 {
@@ -826,7 +843,7 @@ AnalysisDataBinAverageModule::flags() const
 void
 AnalysisDataBinAverageModule::dataStarted(AbstractAnalysisData * /*data*/)
 {
-    allocateValues();
+    impl_->averager_.setColumnCount(rowCount());
 }
 
 
@@ -848,11 +865,8 @@ AnalysisDataBinAverageModule::pointsAdded(const AnalysisDataPointSetRef &points)
     {
         for (int i = 1; i < points.columnCount(); ++i)
         {
-            real y = points.y(i);
-            value(bin, 0) += y;
-            value(bin, 1) += y * y;
+            impl_->averager_.addValue(bin, points.y(i));
         }
-        value(bin, 2) += points.columnCount() - 1;
     }
 }
 
@@ -866,16 +880,13 @@ AnalysisDataBinAverageModule::frameFinished(const AnalysisDataFrameHeader & /*he
 void
 AnalysisDataBinAverageModule::dataFinished()
 {
+    impl_->averager_.finish();
+    allocateValues();
     for (int i = 0; i < settings().binCount(); ++i)
     {
-        real n = value(i, 2);
-        if (n > 0)
-        {
-            real ave = value(i, 0) / n;
-            real std = sqrt(value(i, 1) / n - ave * ave);
-            setValue(i, 0, ave);
-            setValue(i, 1, std);
-        }
+        setValue(i, 0, impl_->averager_.average(i));
+        setValue(i, 1, std::sqrt(impl_->averager_.variance(i)));
+        setValue(i, 2, impl_->averager_.sampleCount(i));
     }
     valuesReady();
 }
index 9066c4168dac76d2eb1a3e970ec4e9f778495f41..aa002e45c5f2319a55743db5ff6531f574d25b1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
  * others, as listed in the AUTHORS file in the top-level source
  * directory and at http://www.gromacs.org.
@@ -470,7 +470,7 @@ class AnalysisDataBinAverageModule : public AbstractAnalysisArrayData,
         void init(const AnalysisHistogramSettings &settings);
 
         //! \copydoc AnalysisDataSimpleHistogramModule::settings()
-        const AnalysisHistogramSettings &settings() const { return settings_; }
+        const AnalysisHistogramSettings &settings() const;
 
         virtual int flags() const;
 
@@ -481,7 +481,9 @@ class AnalysisDataBinAverageModule : public AbstractAnalysisArrayData,
         virtual void dataFinished();
 
     private:
-        AnalysisHistogramSettings  settings_;
+        class Impl;
+
+        PrivateImplPointer<Impl>   impl_;
 
         // Copy and assign disallowed by base.
 };
index b5a52de216239c9b4d086d1101f9296833ff55f7..1b07f5708b439baab5b293a1c9b6b99a8fc8e447 100644 (file)
@@ -66,7 +66,7 @@
           <Real Name="Value">1.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.816497</Real>
+          <Real Name="Value">1.000000</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
@@ -78,7 +78,7 @@
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
@@ -90,7 +90,7 @@
           <Real Name="Value">1.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.816497</Real>
+          <Real Name="Value">1.000000</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index 2f37b40e2138bdbd14913d98b44e63bdbe3b6fb8..34f9de0f37ceceb6f8242a320e247eb99cfaa0d4 100644 (file)
@@ -66,7 +66,7 @@
           <Real Name="Value">1.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.816497</Real>
+          <Real Name="Value">1.000000</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
@@ -78,7 +78,7 @@
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
@@ -90,7 +90,7 @@
           <Real Name="Value">1.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.816497</Real>
+          <Real Name="Value">1.000000</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index d082711626f739a51f134c465389852eaba01f73..37083fc729453a616f1bda3f4910a927dd6184d4 100644 (file)
@@ -95,7 +95,7 @@
           <Real Name="Value">1.333333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.745356</Real>
+          <Real Name="Value">0.816497</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.500000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.500000</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">1.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">1.000000</Real>
+          <Real Name="Value">1.414214</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index c713cd7f2aae808ee00361799a4622a405a0a42b..fa584c1d8750714f3d018924c23a7b3dd7c5659d 100644 (file)
           <Real Name="Value">1.250000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.433013</Real>
+          <Real Name="Value">0.500000</Real>
         </DataValue>
         <DataValue>
           <Real Name="Value">4.000000</Real>
           <Real Name="Value">2.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">1.000000</Real>
+          <Real Name="Value">1.414214</Real>
         </DataValue>
         <DataValue>
           <Real Name="Value">2.000000</Real>
index 79914aab43615b4d0186f63326573397b6669007..ea5f17ececc5ba3b0ef6718979373698b10d44bf 100644 (file)
           <Real Name="Value">1.100000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.489898</Real>
+          <Real Name="Value">0.547723</Real>
         </DataValue>
         <DataValue>
           <Real Name="Value">5.000000</Real>
           <Real Name="Value">2.000000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">1.000000</Real>
+          <Real Name="Value">1.414214</Real>
         </DataValue>
         <DataValue>
           <Real Name="Value">2.000000</Real>
           <Real Name="Value">1.250000</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.750000</Real>
+          <Real Name="Value">1.060660</Real>
         </DataValue>
         <DataValue>
           <Real Name="Value">2.000000</Real>
index cb7ed1a95f707a80a4ee2bddc4640a89d90093f0..ceb629e9a94cf32a5f9d67951ee6b21d366c26bd 100644 (file)
           <Real Name="Value">1.333333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.333333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471405</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index 2fd08f37c3dc3d20972a29d9371f5f56974cef66..4a5ea3e3b10b593dbeb64ae23a2b34b6cd825400 100644 (file)
           <Real Name="Value">1.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471405</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.471404</Real>
+          <Real Name="Value">0.577350</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index 1fc5813debfa9c09825fb48e8fb9428e28f418dd..a1280fe99b741be52e66dd992e12f5e88de16205 100644 (file)
           <Real Name="Value">1.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.942809</Real>
+          <Real Name="Value">1.154701</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">1.333333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">1.247219</Real>
+          <Real Name="Value">1.527525</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.666667</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.942809</Real>
+          <Real Name="Value">1.154701</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index 2172942c0ca708bc65dd286d4779fbed38ca1c5c..4962d39f52984e6b593f5debd235f959ee670c11 100644 (file)
           <Real Name="Value">1.833333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.849837</Real>
+          <Real Name="Value">1.040833</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">1.333333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">1.247219</Real>
+          <Real Name="Value">1.527525</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
           <Real Name="Value">0.833333</Real>
         </DataValue>
         <DataValue>
-          <Real Name="Value">0.849837</Real>
+          <Real Name="Value">1.040833</Real>
         </DataValue>
       </Sequence>
     </DataFrame>
index b8dc70dd746f0710af239aefeeb3a50f740a71fc..2a7e621aff0a2f220a29a10aaca953106619b806 100644 (file)
@@ -70,7 +70,7 @@
             <Real Name="Value">0.012500</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.004167</Real>
+            <Real Name="Value">0.005893</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -82,7 +82,7 @@
             <Real Name="Value">0.002083</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.002083</Real>
+            <Real Name="Value">0.002946</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -94,7 +94,7 @@
             <Real Name="Value">0.002083</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.002083</Real>
+            <Real Name="Value">0.002946</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
index eef1532f568da7549f2c4e35d787ead220bcd215..d3b4239f2b0ba547b941afbd303c563a1318a072 100644 (file)
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
index 97ff96d44cfeb33d271996a382bcb406cff86e0c..814b8c3683bbcef5ea4644c8a7602f9f43931014 100644 (file)
@@ -24,7 +24,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -36,7 +36,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -48,7 +48,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -60,7 +60,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -96,7 +96,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
index cb042f3f65dd87925f87f3d4b3aff33a41ba8aa2..909d736d48e49f4e6885b9920eb18742758e0081 100644 (file)
@@ -24,7 +24,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -36,7 +36,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -48,7 +48,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -60,7 +60,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -96,7 +96,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
index df81b3596fb2e382d70f6416fface9b98a6cf315..688f3f859937fd146b9603b6492feb5d3223f559 100644 (file)
@@ -24,7 +24,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -36,7 +36,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -48,7 +48,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -60,7 +60,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -96,7 +96,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
index 0ef1feb823e66f388f9fb35c4ce8c9ca80ab19d1..a37d3db5cb6f037a0e2f8ac415a9106d1b0c03ae 100644 (file)
@@ -24,7 +24,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -36,7 +36,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -48,7 +48,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -60,7 +60,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>
@@ -96,7 +96,7 @@
             <Real Name="Value">0.500000</Real>
           </DataValue>
           <DataValue>
-            <Real Name="Value">0.500000</Real>
+            <Real Name="Value">0.707107</Real>
           </DataValue>
         </Sequence>
       </DataFrame>