Gromacs  2021.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
#include "gmxpre.h"
#include "gromacs/selection/indexutil.h"
#include "gromacs/utility/arraysize.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/smalloc.h"
#include "keywords.h"
#include "poscalc.h"
#include "position.h"
#include "selelem.h"
#include "selmethod.h"
#include "selmethod_impl.h"
+ Include dependency graph for sm_position.cpp:

Description

Implements position evaluation selection methods.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com

Classes

struct  t_methoddata_pos
 Data structure for position keyword evaluation. More...
 

Functions

static void * init_data_pos (int npar, gmx_ana_selparam_t *param)
 Allocates data for position evaluation selection methods. More...
 
static void set_poscoll_pos (gmx::PositionCalculationCollection *pcc, void *data)
 Sets the position calculation collection for position evaluation selection methods. More...
 
static void init_kwpos (const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
 Initializes position evaluation keywords. More...
 
static void init_cog (const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
 Initializes the cog selection method. More...
 
static void init_com (const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
 Initializes the cog selection method. More...
 
static void init_output_pos (const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
 Initializes output for position evaluation selection methods. More...
 
static void free_data_pos (void *data)
 Frees the data allocated for position evaluation selection methods. More...
 
static void evaluate_pos (const gmx::SelMethodEvalContext &context, gmx_ana_index_t *, gmx_ana_selvalue_t *out, void *data)
 Evaluates position evaluation selection methods. More...
 
bool _gmx_selelem_is_default_kwpos (const gmx::SelectionTreeElement &sel)
 Returns whether the selection element is a default position keyword. More...
 
static void set_pos_method_flags (gmx_ana_selmethod_t *method, t_methoddata_pos *d)
 Updates selection method flags about required topology information. More...
 
void _gmx_selelem_set_kwpos_type (gmx::SelectionTreeElement *sel, const char *type)
 Sets the position type for position keyword evaluation. More...
 
void _gmx_selelem_set_kwpos_flags (gmx::SelectionTreeElement *sel, int flags)
 Sets the flags for position keyword evaluation. More...
 

Variables

static gmx_ana_selparam_t smparams_keyword_pos []
 Parameters for position keyword evaluation. More...
 
static gmx_ana_selparam_t smparams_com []
 Parameters for the cog and com selection methods. More...
 
gmx_ana_selmethod_t sm_keyword_pos
 Selection method data for position keyword evaluation. More...
 
gmx_ana_selmethod_t sm_cog
 Selection method data for the cog method. More...
 
gmx_ana_selmethod_t sm_com
 Selection method data for the com method. More...
 

Function Documentation

bool _gmx_selelem_is_default_kwpos ( const gmx::SelectionTreeElement sel)

Returns whether the selection element is a default position keyword.

Parameters
[in]selSelection element to query.
Returns
true if sel represents a position keyword evaluation that uses the default (implicit) position keyword.

This method only works before the selection has been compiled.

void _gmx_selelem_set_kwpos_flags ( gmx::SelectionTreeElement sel,
int  flags 
)

Sets the flags for position keyword evaluation.

Parameters
[in,out]selSelection element to initialize.
[in]flagsDefault completion flags (see PositionCalculationCollection::typeFromEnum()).

Initializes the flags for position evaluation. 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 
)

Sets the position type for position keyword evaluation.

Parameters
[in,out]selSelection element to initialize.
[in]typeOne of the enum values acceptable for PositionCalculationCollection::typeFromEnum().

Initializes the reference position type for position evaluation. If called multiple times, the first setting takes effect, and later calls are neglected.

static void evaluate_pos ( const gmx::SelMethodEvalContext context,
gmx_ana_index_t ,
gmx_ana_selvalue_t out,
void *  data 
)
static

Evaluates position evaluation selection methods.

See sel_updatefunc() for description of the parameters. data should point to a t_methoddata_pos.

Calculates the positions using t_methoddata_pos::pc for the index group in t_methoddata_pos::g and stores the results in out->u.p.

static void free_data_pos ( void *  data)
static

Frees the data allocated for position evaluation selection methods.

Parameters
dataData to free (should point to a t_methoddata_pos).

Frees the memory allocated for t_methoddata_pos::g and t_methoddata_pos::pc.

static void init_cog ( const gmx_mtop_t *  top,
int  npar,
gmx_ana_selparam_t param,
void *  data 
)
static

Initializes the cog selection method.

Parameters
[in]topTopology data structure.
[in]nparNot used.
[in]paramNot used.
[in,out]dataShould point to 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

Initializes the cog selection method.

Parameters
[in]topTopology data structure.
[in]nparNot used.
[in]paramNot used.
[in,out]dataShould point to t_methoddata_pos.
Returns
0 on success, a non-zero error code on error.
static void * init_data_pos ( int  npar,
gmx_ana_selparam_t param 
)
static

Allocates data for position evaluation selection methods.

Parameters
[in]nparShould be 1 or 2.
[in,out]paramMethod parameters (should point to smparams_keyword_pos or smparams_com).
Returns
Pointer to the allocated data (t_methoddata_pos).

Allocates memory for a t_methoddata_pos structure and initializes the first parameter to define the value for t_methoddata_pos::g. If a second parameter is present, it is used for setting the t_methoddata_pos::bPBC flag.

static void init_kwpos ( const gmx_mtop_t *  top,
int  npar,
gmx_ana_selparam_t param,
void *  data 
)
static

Initializes position evaluation keywords.

Parameters
[in]topNot used.
[in]nparNot used.
[in]paramNot used.
[in,out]dataShould point to t_methoddata_pos.
Returns
0 on success, a non-zero error code on error.

The t_methoddata_pos::type field should have been initialized externally using _gmx_selelem_set_kwpos_type().

static void init_output_pos ( const gmx_mtop_t *  top,
gmx_ana_selvalue_t out,
void *  data 
)
static

Initializes output for position evaluation selection methods.

Parameters
[in]topTopology data structure.
[in,out]outPointer to output data structure.
[in,out]dataShould point to t_methoddata_pos.
Returns
0 for success.
static void set_pos_method_flags ( gmx_ana_selmethod_t method,
t_methoddata_pos d 
)
static

Updates selection method flags about required topology information.

Sets the flags to require topology and/or masses if the position calculation requires them.

static void set_poscoll_pos ( gmx::PositionCalculationCollection pcc,
void *  data 
)
static

Sets the position calculation collection for position evaluation selection methods.

Parameters
[in]pccPosition calculation collection to use.
[in,out]dataShould point to t_methoddata_pos.

Variable Documentation

Initial value:
= {
"cog",
4 | 8 ,
nullptr,
nullptr,
{ "cog of ATOM_EXPR [pbc]", nullptr, 0, nullptr },
}
static void init_output_pos(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
Initializes output for position evaluation selection methods.
Definition: sm_position.cpp:353
One or more position values.
Definition: selvalue.h:58
static void evaluate_pos(const gmx::SelMethodEvalContext &context, gmx_ana_index_t *, gmx_ana_selvalue_t *out, void *data)
Evaluates position evaluation selection methods.
Definition: sm_position.cpp:382
constexpr int asize(T(&)[N])
Calculates the number of elements in a static array at compile time.
Definition: arraysize.h:51
static void free_data_pos(void *data)
Frees the data allocated for position evaluation selection methods.
Definition: sm_position.cpp:366
static void set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data)
Sets the position calculation collection for position evaluation selection methods.
Definition: sm_position.cpp:228
static void init_cog(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
Initializes the cog selection method.
Definition: sm_position.cpp:334
static gmx_ana_selparam_t smparams_com[]
Parameters for the cog and com selection methods.
Definition: sm_position.cpp:137
static void * init_data_pos(int npar, gmx_ana_selparam_t *param)
Allocates data for position evaluation selection methods.
Definition: sm_position.cpp:207

Selection method data for the cog method.

Initial value:
= {
"com",
2 | 4 | 8 ,
nullptr,
nullptr,
{ "com of ATOM_EXPR [pbc]", nullptr, 0, nullptr },
}
static void init_output_pos(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
Initializes output for position evaluation selection methods.
Definition: sm_position.cpp:353
One or more position values.
Definition: selvalue.h:58
static void evaluate_pos(const gmx::SelMethodEvalContext &context, gmx_ana_index_t *, gmx_ana_selvalue_t *out, void *data)
Evaluates position evaluation selection methods.
Definition: sm_position.cpp:382
constexpr int asize(T(&)[N])
Calculates the number of elements in a static array at compile time.
Definition: arraysize.h:51
static void free_data_pos(void *data)
Frees the data allocated for position evaluation selection methods.
Definition: sm_position.cpp:366
static void set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data)
Sets the position calculation collection for position evaluation selection methods.
Definition: sm_position.cpp:228
static void init_com(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
Initializes the cog selection method.
Definition: sm_position.cpp:343
static gmx_ana_selparam_t smparams_com[]
Parameters for the cog and com selection methods.
Definition: sm_position.cpp:137
static void * init_data_pos(int npar, gmx_ana_selparam_t *param)
Allocates data for position evaluation selection methods.
Definition: sm_position.cpp:207

Selection method data for the com method.

gmx_ana_selmethod_t sm_keyword_pos
Initial value:
= {
"kw_pos",
4 | 16 | 128 ,
nullptr,
nullptr,
{ nullptr, nullptr, 0, nullptr },
}
static void init_output_pos(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
Initializes output for position evaluation selection methods.
Definition: sm_position.cpp:353
One or more position values.
Definition: selvalue.h:58
static gmx_ana_selparam_t smparams_keyword_pos[]
Parameters for position keyword evaluation.
Definition: sm_position.cpp:132
static void evaluate_pos(const gmx::SelMethodEvalContext &context, gmx_ana_index_t *, gmx_ana_selvalue_t *out, void *data)
Evaluates position evaluation selection methods.
Definition: sm_position.cpp:382
constexpr int asize(T(&)[N])
Calculates the number of elements in a static array at compile time.
Definition: arraysize.h:51
static void init_kwpos(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
Initializes position evaluation keywords.
Definition: sm_position.cpp:318
static void free_data_pos(void *data)
Frees the data allocated for position evaluation selection methods.
Definition: sm_position.cpp:366
static void set_poscoll_pos(gmx::PositionCalculationCollection *pcc, void *data)
Sets the position calculation collection for position evaluation selection methods.
Definition: sm_position.cpp:228
static void * init_data_pos(int npar, gmx_ana_selparam_t *param)
Allocates data for position evaluation selection methods.
Definition: sm_position.cpp:207

Selection method data for position keyword evaluation.

gmx_ana_selparam_t smparams_com[]
static
Initial value:
= {
{ "of", { GROUP_VALUE, 1, { nullptr } }, nullptr, 4 },
{ "pbc", { NO_VALUE, 0, { nullptr } }, nullptr, 0 },
}
One group of atoms.
Definition: selvalue.h:59
No value; either an error condition or an boolean parameter.
Definition: selvalue.h:53

Parameters for the cog and com selection methods.

gmx_ana_selparam_t smparams_keyword_pos[]
static
Initial value:
= {
{ nullptr, { GROUP_VALUE, 1, { nullptr } }, nullptr, 4 },
}
One group of atoms.
Definition: selvalue.h:59

Parameters for position keyword evaluation.