Gromacs  2018.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
#include "gmxpre.h"
#include "gromacs/math/vec.h"
#include "gromacs/selection/position.h"
#include "gromacs/utility/arraysize.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
#include "selmethod.h"
+ Include dependency graph for sm_permute.cpp:

Description

Implements the permute selection modifier.

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

Classes

struct  t_methoddata_permute
 Data structure for the permute selection modifier. More...
 

Functions

static void * init_data_permute (int npar, gmx_ana_selparam_t *param)
 Allocates data for the permute selection modifier. More...
 
static void init_permute (const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
 Initializes data for the permute selection modifier. More...
 
static void init_output_permute (const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
 Initializes output for the permute selection modifier. More...
 
static void free_data_permute (void *data)
 Frees the memory allocated for the permute selection modifier. More...
 
static void evaluate_permute (const gmx::SelMethodEvalContext &context, gmx_ana_pos_t *p, gmx_ana_selvalue_t *out, void *data)
 Evaluates the permute selection modifier. More...
 

Variables

static gmx_ana_selparam_t smparams_permute []
 Parameters for the permute selection modifier. More...
 
static const char *const help_permute []
 Help text for the permute selection modifier. More...
 
gmx_ana_selmethod_t sm_permute
 Selection method data for the permute modifier. More...
 

Function Documentation

static void evaluate_permute ( const gmx::SelMethodEvalContext context,
gmx_ana_pos_t p,
gmx_ana_selvalue_t out,
void *  data 
)
static

Evaluates the permute selection modifier.

Parameters
[in]contextNot used.
[in]pPositions to permute (should point to data->p).
[out]outOutput data structure (out->u.p is used).
[in]dataShould point to a t_methoddata_permute.

Throws if the size of p is not divisible by the number of elements in the permutation.

static void free_data_permute ( void *  data)
static

Frees the memory allocated for the permute selection modifier.

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

Frees the memory allocated for t_methoddata_permute.

static void * init_data_permute ( int  npar,
gmx_ana_selparam_t param 
)
static

Allocates data for the permute selection modifier.

Parameters
[in]nparNot used (should be 2).
[in,out]paramMethod parameters (should point to a copy of smparams_permute).
Returns
Pointer to the allocated data (t_methoddata_permute).

Allocates memory for a t_methoddata_permute structure.

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

Initializes output for the permute selection modifier.

Parameters
[in]topTopology data structure.
[in,out]outPointer to output data structure.
[in,out]dataShould point to t_methoddata_permute.
static void init_permute ( const gmx_mtop_t *  top,
int  npar,
gmx_ana_selparam_t param,
void *  data 
)
static

Initializes data for the permute selection modifier.

Parameters
[in]topNot used.
[in]nparNot used (should be 2).
[in]paramMethod parameters (should point to smparams_permute).
[in]dataShould point to a t_methoddata_permute.
Returns
0 if the input permutation is valid, -1 on error.

Variable Documentation

const char* const help_permute[]
static
Initial value:
= {
"::",
"",
" permute P1 ... PN",
"",
"By default, all selections are evaluated such that the atom indices are",
"returned in ascending order. This can be changed by appending",
"[TT]permute P1 P2 ... PN[tt] to an expression.",
"The [TT]Pi[tt] should form a permutation of the numbers 1 to N.",
"This keyword permutes each N-position block in the selection such that",
"the i'th position in the block becomes Pi'th.",
"Note that it is the positions that are permuted, not individual atoms.",
"A fatal error occurs if the size of the selection is not a multiple of n.",
"It is only possible to permute the whole selection expression, not any",
"subexpressions, i.e., the [TT]permute[tt] keyword should appear last in",
"a selection.",
}

Help text for the permute selection modifier.

gmx_ana_selmethod_t sm_permute
Initial value:
= {
"permute", POS_VALUE, 256 ,
((int)(sizeof( smparams_permute )/sizeof(( smparams_permute )[0]))), smparams_permute,
nullptr,
nullptr,
nullptr,
{"POSEXPR permute P1 ... PN",
"Permuting selections", ((int)(sizeof( help_permute )/sizeof(( help_permute )[0]))), help_permute},
}
static void init_output_permute(const gmx_mtop_t *top, gmx_ana_selvalue_t *out, void *data)
Initializes output for the permute selection modifier.
Definition: sm_permute.cpp:204
static void free_data_permute(void *data)
Frees the memory allocated for the permute selection modifier.
Definition: sm_permute.cpp:229
static void evaluate_permute(const gmx::SelMethodEvalContext &context, gmx_ana_pos_t *p, gmx_ana_selvalue_t *out, void *data)
Evaluates the permute selection modifier.
Definition: sm_permute.cpp:238
static void init_permute(const gmx_mtop_t *top, int npar, gmx_ana_selparam_t *param, void *data)
Initializes data for the permute selection modifier.
Definition: sm_permute.cpp:171
One or more position values.
Definition: selvalue.h:58
static const char *const help_permute[]
Help text for the permute selection modifier.
Definition: sm_permute.cpp:125
static gmx_ana_selparam_t smparams_permute[]
Parameters for the permute selection modifier.
Definition: sm_permute.cpp:119
static void * init_data_permute(int npar, gmx_ana_selparam_t *param)
Allocates data for the permute selection modifier.
Definition: sm_permute.cpp:160

Selection method data for the permute modifier.

gmx_ana_selparam_t smparams_permute[]
static
Initial value:
= {
{nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, 4 | 16 },
{nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, 16 },
}
One or more position values.
Definition: selvalue.h:58
One or more integer values.
Definition: selvalue.h:55

Parameters for the permute selection modifier.