typedef struct
{
/** Position calculation collection to use. */
- gmx::PositionCalculationCollection *pcc;
+ gmx::PositionCalculationCollection* pcc;
/** Index group for which the center should be evaluated. */
- gmx_ana_index_t g;
+ gmx_ana_index_t g;
/** Position evaluation data structure. */
- gmx_ana_poscalc_t *pc;
+ gmx_ana_poscalc_t* pc;
/** true if periodic boundary conditions should be used. */
- bool bPBC;
+ bool bPBC;
/** Type of positions to calculate. */
- char *type;
+ char* type;
/** Flags for the position calculation. */
- int flags;
+ int flags;
} t_methoddata_pos;
/** Allocates data for position evaluation selection methods. */
-static void *
-init_data_pos(int npar, gmx_ana_selparam_t *param);
+static void* init_data_pos(int npar, gmx_ana_selparam_t* param);
/** Sets the position calculation collection for position evaluation selection methods. */
-static void
-set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data);
+static void set_poscoll_pos(gmx::PositionCalculationCollection* pcc, void* data);
/*! \brief
* Initializes position evaluation keywords.
*
* The \c t_methoddata_pos::type field should have been initialized
* externally using _gmx_selelem_set_kwpos_type().
*/
-static void
-init_kwpos(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data);
+static void init_kwpos(const gmx_mtop_t* top, int npar, gmx_ana_selparam_t* param, void* data);
/*! \brief
* Initializes the \p cog selection method.
*
* \param[in,out] data Should point to \c t_methoddata_pos.
* \returns 0 on success, a non-zero error code on error.
*/
-static void
-init_cog(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data);
+static void init_cog(const gmx_mtop_t* top, int npar, gmx_ana_selparam_t* param, void* data);
/*! \brief
* Initializes the \p cog selection method.
*
* \param[in,out] data Should point to \c t_methoddata_pos.
* \returns 0 on success, a non-zero error code on error.
*/
-static void
-init_com(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data);
+static void init_com(const gmx_mtop_t* top, int npar, gmx_ana_selparam_t* param, void* data);
/*! \brief
* Initializes output for position evaluation selection methods.
*
* \param[in,out] data Should point to \c t_methoddata_pos.
* \returns 0 for success.
*/
-static void
-init_output_pos(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data);
+static void init_output_pos(const gmx_mtop_t* top, gmx_ana_selvalue_t* out, void* data);
/** Frees the data allocated for position evaluation selection methods. */
-static void
-free_data_pos(void *data);
+static void free_data_pos(void* data);
/** Evaluates position evaluation selection methods. */
-static void
-evaluate_pos(const gmx::SelMethodEvalContext &context,
- gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data);
+static void evaluate_pos(const gmx::SelMethodEvalContext& context,
+ gmx_ana_index_t* /* g */,
+ gmx_ana_selvalue_t* out,
+ void* data);
/** Parameters for position keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_pos[] = {
- {nullptr, {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
+ { nullptr, { GROUP_VALUE, 1, { nullptr } }, nullptr, SPAR_DYNAMIC },
};
/** Parameters for the \p cog and \p com selection methods. */
static gmx_ana_selparam_t smparams_com[] = {
- {"of", {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
- {"pbc", {NO_VALUE, 0, {nullptr}}, nullptr, 0},
+ { "of", { GROUP_VALUE, 1, { nullptr } }, nullptr, SPAR_DYNAMIC },
+ { "pbc", { NO_VALUE, 0, { nullptr } }, nullptr, 0 },
};
/** Selection method data for position keyword evaluation. */
gmx_ana_selmethod_t sm_keyword_pos = {
- "kw_pos", POS_VALUE, SMETH_DYNAMIC | SMETH_VARNUMVAL | SMETH_ALLOW_UNSORTED,
- asize(smparams_keyword_pos), smparams_keyword_pos,
+ "kw_pos",
+ POS_VALUE,
+ SMETH_DYNAMIC | SMETH_VARNUMVAL | SMETH_ALLOW_UNSORTED,
+ asize(smparams_keyword_pos),
+ smparams_keyword_pos,
&init_data_pos,
&set_poscoll_pos,
&init_kwpos,
nullptr,
&evaluate_pos,
nullptr,
- {nullptr, nullptr, 0, nullptr},
+ { nullptr, nullptr, 0, nullptr },
};
/** Selection method data for the \p cog method. */
gmx_ana_selmethod_t sm_cog = {
- "cog", POS_VALUE, SMETH_DYNAMIC | SMETH_SINGLEVAL,
- asize(smparams_com), smparams_com,
+ "cog",
+ POS_VALUE,
+ SMETH_DYNAMIC | SMETH_SINGLEVAL,
+ asize(smparams_com),
+ smparams_com,
&init_data_pos,
&set_poscoll_pos,
&init_cog,
nullptr,
&evaluate_pos,
nullptr,
- {"cog of ATOM_EXPR [pbc]", nullptr, 0, nullptr},
+ { "cog of ATOM_EXPR [pbc]", nullptr, 0, nullptr },
};
/** Selection method data for the \p com method. */
gmx_ana_selmethod_t sm_com = {
- "com", POS_VALUE, SMETH_REQMASS | SMETH_DYNAMIC | SMETH_SINGLEVAL,
- asize(smparams_com), smparams_com,
+ "com",
+ POS_VALUE,
+ SMETH_REQMASS | SMETH_DYNAMIC | SMETH_SINGLEVAL,
+ asize(smparams_com),
+ smparams_com,
&init_data_pos,
&set_poscoll_pos,
&init_com,
nullptr,
&evaluate_pos,
nullptr,
- {"com of ATOM_EXPR [pbc]", nullptr, 0, nullptr},
+ { "com of ATOM_EXPR [pbc]", nullptr, 0, nullptr },
};
/*!
* If a second parameter is present, it is used for setting the
* \c t_methoddata_pos::bPBC flag.
*/
-static void *
-init_data_pos(int npar, gmx_ana_selparam_t *param)
+static void* init_data_pos(int npar, gmx_ana_selparam_t* param)
{
- t_methoddata_pos *data;
+ t_methoddata_pos* data;
snew(data, 1);
param[0].val.u.g = &data->g;
{
param[1].val.u.b = &data->bPBC;
}
- data->pc = nullptr;
- data->bPBC = false;
- data->type = nullptr;
- data->flags = -1;
+ data->pc = nullptr;
+ data->bPBC = false;
+ data->type = nullptr;
+ data->flags = -1;
return data;
}
* \param[in] pcc Position calculation collection to use.
* \param[in,out] data Should point to \c t_methoddata_pos.
*/
-static void
-set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data)
+static void set_poscoll_pos(gmx::PositionCalculationCollection* pcc, void* data)
{
- (static_cast<t_methoddata_pos *>(data))->pcc = pcc;
+ (static_cast<t_methoddata_pos*>(data))->pcc = pcc;
}
-bool
-_gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement &sel)
+bool _gmx_selelem_is_default_kwpos(const gmx::SelectionTreeElement& sel)
{
if (sel.type != SEL_EXPRESSION || !sel.u.expr.method
|| sel.u.expr.method->name != sm_keyword_pos.name)
return false;
}
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(sel.u.expr.mdata);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(sel.u.expr.mdata);
return d->type == nullptr;
}
* Sets the flags to require topology and/or masses if the position calculation
* requires them.
*/
-static void set_pos_method_flags(gmx_ana_selmethod_t *method,
- t_methoddata_pos *d)
+static void set_pos_method_flags(gmx_ana_selmethod_t* method, t_methoddata_pos* d)
{
const bool forces = (d->flags != -1 && ((d->flags & POS_FORCES) != 0));
switch (gmx::PositionCalculationCollection::requiredTopologyInfoForType(d->type, forces))
case gmx::PositionCalculationCollection::RequiredTopologyInfo::Topology:
method->flags |= SMETH_REQTOP;
break;
- case gmx::PositionCalculationCollection::RequiredTopologyInfo::None:
- break;
+ case gmx::PositionCalculationCollection::RequiredTopologyInfo::None: break;
}
}
* If called multiple times, the first setting takes effect, and later calls
* are neglected.
*/
-void
-_gmx_selelem_set_kwpos_type(gmx::SelectionTreeElement *sel, const char *type)
+void _gmx_selelem_set_kwpos_type(gmx::SelectionTreeElement* sel, const char* type)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(sel->u.expr.mdata);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(sel->u.expr.mdata);
if (sel->type != SEL_EXPRESSION || !sel->u.expr.method
|| sel->u.expr.method->name != sm_keyword_pos.name)
* If called multiple times, the first setting takes effect, and later calls
* are neglected.
*/
-void
-_gmx_selelem_set_kwpos_flags(gmx::SelectionTreeElement *sel, int flags)
+void _gmx_selelem_set_kwpos_flags(gmx::SelectionTreeElement* sel, int flags)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(sel->u.expr.mdata);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(sel->u.expr.mdata);
if (sel->type != SEL_EXPRESSION || !sel->u.expr.method
|| sel->u.expr.method->name != sm_keyword_pos.name)
}
if (d->flags == -1)
{
- GMX_RELEASE_ASSERT(d->type != nullptr,
- "Position type should be set before flags");
+ GMX_RELEASE_ASSERT(d->type != nullptr, "Position type should be set before flags");
d->flags = flags;
set_pos_method_flags(sel->u.expr.method, d);
}
}
-static void
-init_kwpos(const gmx_mtop_t * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
+static void init_kwpos(const gmx_mtop_t* /* top */, int /* npar */, gmx_ana_selparam_t* param, void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
if (!(param[0].flags & SPAR_DYNAMIC))
{
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-static void
-init_cog(const gmx_mtop_t * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
+static void init_cog(const gmx_mtop_t* /* top */, int /* npar */, gmx_ana_selparam_t* param, void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
d->flags = (param[0].flags & SPAR_DYNAMIC) ? POS_DYNAMIC : 0;
d->pc = d->pcc->createCalculation(d->bPBC ? POS_ALL_PBC : POS_ALL, d->flags);
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-static void
-init_com(const gmx_mtop_t * /* top */, int /* npar */, gmx_ana_selparam_t *param, void *data)
+static void init_com(const gmx_mtop_t* /* top */, int /* npar */, gmx_ana_selparam_t* param, void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
- d->flags = (param[0].flags & SPAR_DYNAMIC) ? POS_DYNAMIC : 0;
+ d->flags = (param[0].flags & SPAR_DYNAMIC) ? POS_DYNAMIC : 0;
d->flags |= POS_MASS;
- d->pc = d->pcc->createCalculation(d->bPBC ? POS_ALL_PBC : POS_ALL, d->flags);
+ d->pc = d->pcc->createCalculation(d->bPBC ? POS_ALL_PBC : POS_ALL, d->flags);
gmx_ana_poscalc_set_maxindex(d->pc, &d->g);
}
-static void
-init_output_pos(const gmx_mtop_t * /* top */, gmx_ana_selvalue_t *out, void *data)
+static void init_output_pos(const gmx_mtop_t* /* top */, gmx_ana_selvalue_t* out, void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
gmx_ana_poscalc_init_pos(d->pc, out->u.p);
}
* Frees the memory allocated for \c t_methoddata_pos::g and
* \c t_methoddata_pos::pc.
*/
-static void
-free_data_pos(void *data)
+static void free_data_pos(void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
sfree(d->type);
gmx_ana_poscalc_free(d->pc);
* Calculates the positions using \c t_methoddata_pos::pc for the index group
* in \c t_methoddata_pos::g and stores the results in \p out->u.p.
*/
-static void
-evaluate_pos(const gmx::SelMethodEvalContext &context,
- gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void *data)
+static void evaluate_pos(const gmx::SelMethodEvalContext& context,
+ gmx_ana_index_t* /* g */,
+ gmx_ana_selvalue_t* out,
+ void* data)
{
- t_methoddata_pos *d = static_cast<t_methoddata_pos *>(data);
+ t_methoddata_pos* d = static_cast<t_methoddata_pos*>(data);
gmx_ana_poscalc_update(d->pc, out->u.p, &d->g, context.fr, context.pbc);
}