Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
mtop_lookup.h File Reference
#include "gromacs/topology/topology.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/gmxassert.h"
+ Include dependency graph for mtop_lookup.h:
+ This graph shows which files directly or indirectly include this file:

Description

This file contains inline functions to look up atom information using the global atom index.

Author
Berk Hess hess@.nosp@m.kth..nosp@m.se

Functions

static void mtopGetMolblockIndex (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock, int *moleculeIndex, int *atomIndexInMolecule)
 Look up the molecule block and other indices of a global atom index. More...
 
static int mtopGetMoleculeIndex (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock)
 Returns the global molecule index of a global atom index. More...
 
static const t_atom & mtopGetAtomParameters (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock)
 Returns the atom data for an atom based on global atom index. More...
 
static real mtopGetAtomMass (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock)
 Returns the mass of an atom based on global atom index. More...
 
static void mtopGetAtomAndResidueName (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock, const char **atomName, int *residueNumber, const char **residueName, int *globalResidueIndex)
 Look up the atom and residue name and residue number and index of a global atom index. More...
 
static void mtopGetAtomAndResidueName (const gmx_mtop_t &mtop, int globalAtomIndex, int *moleculeBlock, const char **atomName, int *residueNumber, const char **residueName, int *globalResidueIndex)
 Look up the atom and residue name and residue number and index of a global atom index. More...
 
static const t_resinfo & mtopGetResidueInfo (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock)
 Returns residue information for an atom based on global atom index. More...
 
static const t_pdbinfo & mtopGetAtomPdbInfo (const gmx_mtop_t *mtop, int globalAtomIndex, int *moleculeBlock)
 Returns PDB information for an atom based on global atom index. More...
 

Function Documentation

static void mtopGetAtomAndResidueName ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock,
const char **  atomName,
int *  residueNumber,
const char **  residueName,
int *  globalResidueIndex 
)
inlinestatic

Look up the atom and residue name and residue number and index of a global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time. Note that this function does a (somewhat expensive) lookup. If you want to look up data sequentially for all atoms in a molecule or the system, use one of the mtop loop functionalities.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
[out]atomNameThe atom name, input can be NULL
[out]residueNumberThe residue number, input can be NULL
[out]residueNameThe residue name, input can be NULL
[out]globalResidueIndexThe gobal residue index, input can be NULL
static void mtopGetAtomAndResidueName ( const gmx_mtop_t &  mtop,
int  globalAtomIndex,
int *  moleculeBlock,
const char **  atomName,
int *  residueNumber,
const char **  residueName,
int *  globalResidueIndex 
)
inlinestatic

Look up the atom and residue name and residue number and index of a global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time. Note that this function does a (somewhat expensive) lookup. If you want to look up data sequentially for all atoms in a molecule or the system, use one of the mtop loop functionalities.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
[out]atomNameThe atom name, input can be NULL
[out]residueNumberThe residue number, input can be NULL
[out]residueNameThe residue name, input can be NULL
[out]globalResidueIndexThe gobal residue index, input can be NULL
static real mtopGetAtomMass ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock 
)
inlinestatic

Returns the mass of an atom based on global atom index.

Returns that A-state mass of the atom with global index globalAtomIndex. The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
static const t_atom& mtopGetAtomParameters ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock 
)
inlinestatic

Returns the atom data for an atom based on global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
static const t_pdbinfo& mtopGetAtomPdbInfo ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock 
)
inlinestatic

Returns PDB information for an atom based on global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
static void mtopGetMolblockIndex ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock,
int *  moleculeIndex,
int *  atomIndexInMolecule 
)
inlinestatic

Look up the molecule block and other indices of a global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
[out]moleculeIndexThe index of the molecule in the block, can be NULL
[out]atomIndexInMoleculeThe atom index in the molecule, can be NULL
static int mtopGetMoleculeIndex ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock 
)
inlinestatic

Returns the global molecule index of a global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop
static const t_resinfo& mtopGetResidueInfo ( const gmx_mtop_t *  mtop,
int  globalAtomIndex,
int *  moleculeBlock 
)
inlinestatic

Returns residue information for an atom based on global atom index.

The atom index has to be in range: 0 <= globalAtomIndex < mtop->natoms. The input value of moleculeBlock should be in range. Use 0 as starting value. For subsequent calls to this function, e.g. in a loop, pass in the previously returned value for best performance. Atoms in a group tend to be in the same molecule(block), so this minimizes the search time.

Parameters
[in]mtopThe molecule topology
[in]globalAtomIndexThe global atom index to look up
[in,out]moleculeBlockThe molecule block index in mtop