/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, 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.
double lambda;
int fep_state;
bool bAtoms;
- // TODO
- /*void *atoms;*/
+ t_atoms *atoms;
bool bPrec;
double prec;
bool bX;
- SIP_PYOBJECT x {
+ SIP_PYOBJECT x /NoSetter/ {
%GetCode
sipPy = array2dToNumpy(sipCpp->natoms, 3, sipCpp->x);
- %End
- %SetCode
-
%End
};
bool bV;
- SIP_PYOBJECT v {
+ SIP_PYOBJECT v /NoSetter/ {
%GetCode
sipPy = array2dToNumpy(sipCpp->natoms, 3, sipCpp->v);
- %End
- %SetCode
-
%End
};
bool bF;
- SIP_PYOBJECT f {
+ SIP_PYOBJECT f /NoSetter/ {
%GetCode
sipPy = array2dToNumpy(sipCpp->natoms, 3, sipCpp->f);
- %End
- %SetCode
-
%End
};
bool bBox;
- SIP_PYOBJECT box {
+ SIP_PYOBJECT box /NoSetter/ {
%GetCode
sipPy = array2dToNumpy(3, 3, sipCpp->box);
- %End
- %SetCode
-
%End
};
bool bPBC;
int ndim_ePBC;
int ePBCDX;
int dim;
- SIP_PYOBJECT box {
+ SIP_PYOBJECT box /NoSetter/ {
%GetCode
sipPy = array2dToNumpy(3, 3, sipCpp->box);
- %End
- %SetCode
-
%End
};
- SIP_PYOBJECT fbox_diag {
+ SIP_PYOBJECT fbox_diag /NoSetter/ {
%GetCode
sipPy = array1dToNumpy(3, sipCpp->fbox_diag);
- %End
- %SetCode
-
%End
};
- SIP_PYOBJECT hbox_diag {
+ SIP_PYOBJECT hbox_diag /NoSetter/ {
%GetCode
sipPy = array1dToNumpy(3, sipCpp->hbox_diag);
- %End
- %SetCode
-
%End
};
- SIP_PYOBJECT mhbox_diag {
+ SIP_PYOBJECT mhbox_diag /NoSetter/ {
%GetCode
sipPy = array1dToNumpy(3, sipCpp->mhbox_diag);
- %End
- %SetCode
-
%End
};
double max_cutoff2;
virtual void finish() = 0;
};
-class TrajectoryAnalysisModule {
+%ModuleHeaderCode
+#include "gromacs/utility/exceptions.h"
+%End
+
+%VirtualErrorHandler vehandler
+ SIP_RELEASE_GIL(sipGILState);
+
+ GMX_THROW(gmx::InternalError("Python virtual overload raised an exception, see traceback"));
+%End
+
+%Include vector.sip
+
+class TrajectoryAnalysisModule /VirtualErrorHandler=vehandler/ {
%TypeHeaderCode
#include <gromacs/trajectoryanalysis/analysismodule.h>
using namespace gmx;
%End
public:
- virtual void initOptions(Options *options, TrajectoryAnalysisSettings *settings) = 0;
- virtual void optionsFinished(Options *options, TrajectoryAnalysisSettings *settings);
+ virtual void initOptions(IOptionsContainer *options, TrajectoryAnalysisSettings *settings) = 0;
+ virtual void optionsFinished(TrajectoryAnalysisSettings *settings);
virtual void initAnalysis(const TrajectoryAnalysisSettings &settings, const TopologyInformation &top) = 0;
virtual void initAfterFirstFrame(const TrajectoryAnalysisSettings &settings, const t_trxframe &fr);
// virtual TrajectoryAnalysisModuleDataPointer startFrames (const AnalysisDataParallelOptions &opt, const SelectionCollection &selections);
- virtual void analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, TrajectoryAnalysisModuleData *pdata ) = 0;
+ virtual void analyzeFrame(int frnr, const t_trxframe &fr, t_pbc *pbc, TrajectoryAnalysisModuleData *pdata) = 0;
virtual void finishFrames(TrajectoryAnalysisModuleData *pdata);
virtual void finishAnalysis(int nframes) = 0;
virtual void writeOutput() = 0;
+ virtual const std::vector<TrajectoryAnalysisModule*> getBatch();
+ virtual const std::vector<char*> getArgv(int);
const char* name() const;
const char* description() const;
int datasetCount() const;
+// const std::vector<std::string> datasetNames() const;
+ AbstractAnalysisData& datasetFromIndex(int index) const;
+ AbstractAnalysisData& datasetFromName(const char *name) const;
protected:
TrajectoryAnalysisModule(const char *name, const char *description);
private:
SIP_UNBLOCK_THREADS
%End
};
-
-class TrajectoryAnalysisCommandLineRunner {
-%TypeHeaderCode
-#include <gromacs/trajectoryanalysis/cmdlinerunner.h>
-%End
-
-public:
- TrajectoryAnalysisCommandLineRunner(TrajectoryAnalysisModule *module);
- int run(SIP_PYLIST) throw (gmx::InconsistentInputError);
- %MethodCode
- int argc = PyList_GET_SIZE(a0);
-
- char **argv = new char *[argc + 1];
-
- // Convert the list.
- for (int a = 0; a < argc; ++a)
- {
- PyObject *arg_obj = PyList_GET_ITEM(a0, a);
- const char *arg = sipString_AsLatin1String(&arg_obj);
-
- if (arg)
- {
- arg = strdup(arg);
- Py_DECREF(arg_obj);
- }
- else
- {
- arg = "unknown";
- }
-
- argv[a] = const_cast<char *>(arg);
- }
-
- argv[argc] = NULL;
-
- try {
- sipCpp->run(argc, argv);
- } catch (gmx::InconsistentInputError &e) {
- sipIsErr = 1;
- PyErr_SetString(sipException_gmx_InconsistentInputError, e.what());
- }
- %End
-private:
- TrajectoryAnalysisCommandLineRunner(const TrajectoryAnalysisCommandLineRunner &other);
-};
-