Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Enumerations | Functions
#include <cstdio>
#include "gromacs/utility/classhelpers.h"
+ Include dependency graph for poscalc.h:
+ This graph shows which files directly or indirectly include this file:

Description

API for structured and optimized calculation of positions.

This header declares an API for calculating positions in an automated way, for internal use by the selection engine. This is useful in particular with dynamic selections, because the same COM/COG positions may be needed in several contexts. The API makes it possible to optimize the evaluation such that any heavy calculation is only done once, and the results just copied if needed more than once. The functions also provide a convenient interface for keeping the whole gmx_ana_pos_t structure up-to-date.

The API is documented in more detail in gmx::PositionCalculationCollection.

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

Classes

class  gmx::PositionCalculationCollection
 Collection of gmx_ana_poscalc_t structures for the same topology. More...
 

Macros

Flags for position calculation.

#define POS_MASS   1
 Use mass weighting. More...
 
#define POS_COMPLMAX   2
 Calculate positions for the same atoms in residues/molecules. More...
 
#define POS_COMPLWHOLE   4
 Calculate positions for whole residues/molecules. More...
 
#define POS_DYNAMIC   16
 Enable handling of changing calculation groups. More...
 
#define POS_MASKONLY   32
 Update gmx_ana_pos_t::m dynamically for an otherwise static calculation. More...
 
#define POS_VELOCITIES   64
 Calculate velocities of the positions.
 
#define POS_FORCES   128
 Calculate forces on the positions.
 

Enumerations

enum  e_poscalc_t {
  POS_ATOM, POS_RES, POS_MOL, POS_ALL,
  POS_ALL_PBC
}
 Specifies the type of positions to be calculated. More...
 

Functions

void gmx_ana_poscalc_set_flags (gmx_ana_poscalc_t *pc, int flags)
 Sets the flags for position calculation. More...
 
void gmx_ana_poscalc_set_maxindex (gmx_ana_poscalc_t *pc, gmx_ana_index_t *g)
 Sets the maximum possible input index group for position calculation. More...
 
void gmx_ana_poscalc_init_pos (gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p)
 Initializes positions for position calculation output. More...
 
void gmx_ana_poscalc_free (gmx_ana_poscalc_t *pc)
 Frees the memory allocated for position calculation. More...
 
gmx::PositionCalculationCollection::RequiredTopologyInfo gmx_ana_poscalc_required_topology_info (gmx_ana_poscalc_t *pc)
 Returns true if the position calculation requires topology information. More...
 
void gmx_ana_poscalc_update (gmx_ana_poscalc_t *pc, gmx_ana_pos_t *p, gmx_ana_index_t *g, t_trxframe *fr, const t_pbc *pbc)
 Updates a single COM/COG structure for a frame. More...
 

Macro Definition Documentation

#define POS_COMPLMAX   2

Calculate positions for the same atoms in residues/molecules.

If this flag is set, the positions are always calculated using the same atoms for each residue/molecule, even if the evaluation group contains only some of the atoms for some frames. The group passed to gmx_ana_poscalc_set_maxindex() is used to determine the atoms to use for the calculation.

Has no effect unless POS_DYNAMIC is set or if the calculation type is not POS_RES of POS_MOL.

#define POS_COMPLWHOLE   4

Calculate positions for whole residues/molecules.

If this flag is set, the positions will be calculated for whole residues/molecules, even if the group contains only some of the atoms in the residue/molecule.

Has no effect unless the calculation type is POS_RES or POS_MOL.

#define POS_DYNAMIC   16

Enable handling of changing calculation groups.

Can be used for static calculations as well, but implies a small performance penalty.

#define POS_MASKONLY   32

Update gmx_ana_pos_t::m dynamically for an otherwise static calculation.

Has effect only if POS_DYNAMIC is not set.

#define POS_MASS   1

Use mass weighting.

If this flag is set, the positions will be calculated using mass weighting, i.e., one gets center-of-mass positions. Without the flag, center-of-geometry positions are calculated. Does not have any effect if the calculation type is POS_ATOM.

Enumeration Type Documentation

Specifies the type of positions to be calculated.

Enumerator
POS_ATOM 

Copy atomic coordinates.

POS_RES 

Calculate center for each residue.

POS_MOL 

Calculate center for each molecule.

POS_ALL 

Calculate center for the whole group.

POS_ALL_PBC 

Calculate center for the whole group with PBC.

Function Documentation

void gmx_ana_poscalc_free ( gmx_ana_poscalc_t pc)

Frees the memory allocated for position calculation.

Parameters
pcPosition calculation data to be freed.

The pc pointer is invalid after the call.

void gmx_ana_poscalc_init_pos ( gmx_ana_poscalc_t pc,
gmx_ana_pos_t p 
)

Initializes positions for position calculation output.

Parameters
[in]pcPosition calculation data structure.
[out]pOutput positions.

Calls to gmx_ana_poscalc_update() using pc should use only positions initialized with this function. The p->g pointer is initialized to point to an internal group that contains the maximum index group set with gmx_ana_poscalc_set_maxindex().

gmx::PositionCalculationCollection::RequiredTopologyInfo gmx_ana_poscalc_required_topology_info ( gmx_ana_poscalc_t pc)

Returns true if the position calculation requires topology information.

Parameters
[in]pcPosition calculation data to query.
Returns
Which topology information pc requires for initialization and/or evaluation.
void gmx_ana_poscalc_set_flags ( gmx_ana_poscalc_t pc,
int  flags 
)

Sets the flags for position calculation.

Parameters
[in,out]pcPosition calculation data structure.
[in]flagsNew flags.

flags are added to the old flags. If calculation type is POS_ATOM, POS_MASS is automatically cleared. If both POS_DYNAMIC and POS_MASKONLY are provided, POS_DYNAMIC is cleared. If calculation type is not POS_RES or POS_MOL, POS_COMPLMAX and POS_COMPLWHOLE are automatically cleared.

void gmx_ana_poscalc_set_maxindex ( gmx_ana_poscalc_t pc,
gmx_ana_index_t g 
)

Sets the maximum possible input index group for position calculation.

Parameters
[in,out]pcPosition calculation data structure.
[in]gMaximum index group for the calculation.

Subsequent calls to gmx_ana_poscalc_update() should use only subsets of g for evaluation.

The topology should have been set for the collection of which pc is a member.

void gmx_ana_poscalc_update ( gmx_ana_poscalc_t pc,
gmx_ana_pos_t p,
gmx_ana_index_t g,
t_trxframe *  fr,
const t_pbc pbc 
)

Updates a single COM/COG structure for a frame.

Parameters
[in]pcPosition calculation data.
[in,out]pOutput positions, initialized previously with gmx_ana_poscalc_init_pos() using pc.
[in]gIndex group to use for the update.
[in]frCurrent frame.
[in]pbcPBC data, or NULL if no PBC should be used.

gmx_ana_poscalc_init_frame() should be called for each frame before calling this function.