Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
#include "gromacs/math/vectypes.h"
#include "gromacs/selection/indexutil.h"
+ Include dependency graph for position.h:
+ This graph shows which files directly or indirectly include this file:

Description

API for handling positions.

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

Classes

struct  gmx_ana_pos_t
 Stores a set of positions together with their origins. More...
 

Functions

void gmx_ana_pos_reserve (gmx_ana_pos_t *pos, int n, int isize)
 Ensures that enough memory has been allocated to store positions. More...
 
void gmx_ana_pos_reserve_velocities (gmx_ana_pos_t *pos)
 Request memory allocation for velocities. More...
 
void gmx_ana_pos_reserve_forces (gmx_ana_pos_t *pos)
 Request memory allocation for forces. More...
 
void gmx_ana_pos_reserve_for_append (gmx_ana_pos_t *pos, int n, int isize, bool bVelocities, bool bForces)
 Reserves memory for use with gmx_ana_pos_append_init(). More...
 
void gmx_ana_pos_init_const (gmx_ana_pos_t *pos, const rvec x)
 Initializes a gmx_ana_pos_t to represent a constant position. More...
 
void gmx_ana_pos_copy (gmx_ana_pos_t *dest, gmx_ana_pos_t *src, bool bFirst)
 Copies the evaluated positions to a preallocated data structure. More...
 
void gmx_ana_pos_set_nr (gmx_ana_pos_t *pos, int n)
 Sets the number of positions in a position structure. More...
 
void gmx_ana_pos_empty_init (gmx_ana_pos_t *pos)
 Empties a position data structure with full initialization. More...
 
void gmx_ana_pos_empty (gmx_ana_pos_t *pos)
 Empties a position data structure. More...
 
void gmx_ana_pos_append_init (gmx_ana_pos_t *dest, gmx_ana_pos_t *src, int i)
 Appends a position to a preallocated data structure with full initialization. More...
 
void gmx_ana_pos_append (gmx_ana_pos_t *dest, gmx_ana_pos_t *src, int i, int refid)
 Appends a position to a preallocated data structure. More...
 
void gmx_ana_pos_append_finish (gmx_ana_pos_t *pos)
 Updates position data structure state after appends. More...
 
void gmx_ana_pos_add_to_group (gmx_ana_index_t *g, gmx_ana_pos_t *src, int i)
 Appends atoms from a position into a preallocated index group. More...
 

Function Documentation

void gmx_ana_pos_add_to_group ( gmx_ana_index_t g,
gmx_ana_pos_t src,
int  i 
)

Appends atoms from a position into a preallocated index group.

Parameters
[in,out]gData structure to which the new atoms are appended.
[in]srcData structure from which the position is copied.
[in]iIndex in src to copy.
void gmx_ana_pos_append ( gmx_ana_pos_t dest,
gmx_ana_pos_t src,
int  i,
int  refid 
)

Appends a position to a preallocated data structure.

Parameters
[in,out]destData structure to which the new position is appended.
[in]srcData structure from which the position is copied.
[in]iIndex in src to copy.
[in]refidReference ID in out (all negative values are treated as -1).
void gmx_ana_pos_append_finish ( gmx_ana_pos_t pos)

Updates position data structure state after appends.

Parameters
[in,out]posPosition data structure.

After gmx_ana_pos_empty(), internal state of the position data structure is not consistent before this function is called. This function should be called after any gmx_ana_pos_append() calls have been made.

void gmx_ana_pos_append_init ( gmx_ana_pos_t dest,
gmx_ana_pos_t src,
int  i 
)

Appends a position to a preallocated data structure with full initialization.

Parameters
[in,out]destData structure to which the new position is appended.
[in]srcData structure from which the position is copied.
[in]iIndex in from to copy.
void gmx_ana_pos_copy ( gmx_ana_pos_t dest,
gmx_ana_pos_t src,
bool  bFirst 
)

Copies the evaluated positions to a preallocated data structure.

Parameters
[in,out]destDestination positions.
[in]srcSource positions.
[in]bFirstIf true, memory is allocated for dest and a full copy is made; otherwise, only variable parts are copied, and no memory is allocated.

dest should have been initialized somehow (calloc() is enough).

void gmx_ana_pos_empty ( gmx_ana_pos_t pos)

Empties a position data structure.

Parameters
[in,out]posPosition data structure.

Sets the number of positions to 0.

void gmx_ana_pos_empty_init ( gmx_ana_pos_t pos)

Empties a position data structure with full initialization.

Parameters
[in,out]posPosition data structure.

Sets the number of positions to 0.

void gmx_ana_pos_init_const ( gmx_ana_pos_t pos,
const rvec  x 
)

Initializes a gmx_ana_pos_t to represent a constant position.

Parameters
[out]posPosition data structure to initialize.
[in]xPosition vector to use.
void gmx_ana_pos_reserve ( gmx_ana_pos_t pos,
int  n,
int  isize 
)

Ensures that enough memory has been allocated to store positions.

Parameters
[in,out]posPosition data structure.
[in]nMaximum number of positions.
[in]isizeMaximum number of atoms.

Ensures that enough memory is allocated in pos to calculate n positions from isize atoms.

void gmx_ana_pos_reserve_for_append ( gmx_ana_pos_t pos,
int  n,
int  isize,
bool  bVelocities,
bool  bForces 
)

Reserves memory for use with gmx_ana_pos_append_init().

Parameters
[in,out]posPosition data structure.
[in]nMaximum number of positions.
[in]isizeMaximum number of atoms.
[in]bVelocitiesWhether to reserve space for velocities.
[in]bForcesWhether to reserve space for forces.

Ensures that enough memory is allocated in pos to calculate n positions from isize atoms.

This method needs to be called instead of gmx_ana_pos_reserve() if the intent is to use gmx_ana_pos_append_init()/gmx_ana_pos_append().

void gmx_ana_pos_reserve_forces ( gmx_ana_pos_t pos)

Request memory allocation for forces.

Parameters
[in,out]posPosition data structure.

Currently, this function can only be called after gmx_ana_pos_reserve() has been called at least once with a n >= 0.

void gmx_ana_pos_reserve_velocities ( gmx_ana_pos_t pos)

Request memory allocation for velocities.

Parameters
[in,out]posPosition data structure.

Currently, this function can only be called after gmx_ana_pos_reserve() has been called at least once with a n >= 0.

void gmx_ana_pos_set_nr ( gmx_ana_pos_t pos,
int  nr 
)

Sets the number of positions in a position structure.

Parameters
[in,out]posPosition data structure.
[in]nrNumber of positions.