/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014, 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.
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_trajectoryanalysis
*/
-#include "gromacs/trajectoryanalysis/analysismodule.h"
+#include "gmxpre.h"
+
+#include "analysismodule.h"
#include <utility>
const AnalysisDataParallelOptions &opt,
const SelectionCollection &selections);
+ //! Checks whether the given AnalysisData has been initialized.
+ bool isInitialized(const AnalysisData &data) const;
+
//! Keeps a data handle for each AnalysisData object.
HandleContainer handles_;
//! Stores thread-local selections.
for (i = module->impl_->analysisDatasets_.begin();
i != module->impl_->analysisDatasets_.end(); ++i)
{
- handles_.insert(std::make_pair(i->second, i->second->startData(opt)));
+ AnalysisDataHandle handle;
+ if (isInitialized(*i->second))
+ {
+ handle = i->second->startData(opt);
+ }
+ handles_.insert(std::make_pair(i->second, handle));
}
}
+bool TrajectoryAnalysisModuleData::Impl::isInitialized(
+ const AnalysisData &data) const
+{
+ for (int i = 0; i < data.dataSetCount(); ++i)
+ {
+ if (data.columnCount(i) > 0)
+ {
+ // If not all of the column counts are set, startData() in the
+ // constructor asserts, so that does not need to be checked here.
+ return true;
+ }
+ }
+ return false;
+}
+
/********************************************************************
* TrajectoryAnalysisModuleData
Impl::HandleContainer::iterator i;
for (i = impl_->handles_.begin(); i != impl_->handles_.end(); ++i)
{
- i->second.finishData();
+ if (i->second.isValid())
+ {
+ i->second.finishData();
+ }
}
impl_->handles_.clear();
}
}
-void TrajectoryAnalysisModule::initAfterFirstFrame(const t_trxframe & /*fr*/)
+void TrajectoryAnalysisModule::initAfterFirstFrame(
+ const TrajectoryAnalysisSettings & /*settings*/,
+ const t_trxframe & /*fr*/)
{
}