#include <string>
#include <vector>
#include "gromacs/trajectory/trajectoryframe.h"
using namespace gmx;
{
public:
AnalysisTemplate();
virtual void finishAnalysis(int nframes);
virtual void writeOutput();
private:
class ModuleData;
std::string fnDist_;
double cutoff_;
};
AnalysisTemplate::AnalysisTemplate() : cutoff_(0.0)
{
registerAnalysisDataset(&data_, "avedist");
}
{
static const char* const desc[] = {
"This is a template for writing your own analysis tools for",
"GROMACS. The advantage of using GROMACS for this is that you",
"have access to all information in the topology, and your",
"program will be able to handle all types of coordinates and",
"trajectory files supported by GROMACS. In addition,",
"you get a lot of functionality for free from the trajectory",
"analysis library, including support for flexible dynamic",
"selections. Go ahead an try it![PAR]",
"To get started with implementing your own analysis program,",
"follow the instructions in the README file provided.",
"This template implements a simple analysis programs that calculates",
"average distances from a reference group to one or more",
"analysis groups."
};
.filetype(OptionFileType::Plot)
.outputFile()
.defaultBasename("avedist")
.description("Average distances from reference group"));
SelectionOption(
"reference").
store(&refsel_).required().description(
"Reference group to calculate distances from"));
"Groups to calculate distances to"));
"Cutoff for distance calculation (0 = no cutoff)"));
settings->
setFlag(TrajectoryAnalysisSettings::efRequireTop);
}
{
data_.setColumnCount(0, sel_.size());
data_.addModule(avem_);
if (!fnDist_.empty())
{
plotm->setFileName(fnDist_);
plotm->setTitle("Average distance");
plotm->setXAxisIsTime();
plotm->setYLabel("Distance (nm)");
data_.addModule(plotm);
}
}
{
for (size_t g = 0; g < sel_.size(); ++g)
{
for (int i = 0; i < nr; ++i)
{
}
frave /= nr;
}
}
void AnalysisTemplate::finishAnalysis(int ) {}
void AnalysisTemplate::writeOutput()
{
for (size_t g = 0; g < sel_.size(); ++g)
{
fprintf(stderr, "Average mean distance for '%s': %.3f nm\n", sel_[g].name(), avem_->average(0, g));
}
}
int main(
int argc,
char* argv[])
{
return gmx::TrajectoryAnalysisCommandLineRunner::runAsMain<AnalysisTemplate>(argc, argv);
}