BondTable Class Reference

#include <GromacsTopFile.h>

List of all members.

Public Member Functions

int size () const
int getIndex (Real b0, Real kB, int funct)
void addType (const char *typea, const char *typeb, Real b0, Real kB, int funct)
void getParams (int num, Real *b0, Real *kB, int *funct) const
int getParams (const char *typea, const char *typeb, int funct, Real *b0, Real *kB) const


Detailed Description

Definition at line 234 of file GromacsTopFile.h.


Member Function Documentation

void BondTable::addType ( const char *  typea,
const char *  typeb,
Real  b0,
Real  kB,
int  funct 
)

Definition at line 1271 of file GromacsTopFile.C.

References ResizeArray< Elem >::add().

Referenced by GromacsTopFile::GromacsTopFile().

01272                                                            {
01273   b0Array.add(b0);
01274   kBArray.add(kB);
01275   functArray.add(funct);
01276   typeaArray.add(strdup(typea));
01277   typebArray.add(strdup(typeb));
01278 }

int BondTable::getIndex ( Real  b0,
Real  kB,
int  funct 
)

Definition at line 990 of file GromacsTopFile.C.

References ResizeArray< Elem >::add().

Referenced by GromacsTopFile::GromacsTopFile().

00990                                                      {
00991   /* check to see if it is in the table already */
00992   int i;
00993   for(i=0;i<b0Array.size();i++) {
00994     if(fabs(b0-b0Array[i])<0.00001 &&
00995        fabs(kB-kBArray[i])<0.00001 &&
00996        funct == functArray[i]) {
00997       return i;
00998     }
00999   }
01000   
01001   /* nope, it wasn't in the table add a new element! */
01002   b0Array.add(b0);
01003   kBArray.add(kB);
01004   functArray.add(funct);
01005   typeaArray.add(NULL);
01006   typebArray.add(NULL);
01007   return b0Array.size()-1;
01008 }

int BondTable::getParams ( const char *  typea,
const char *  typeb,
int  funct,
Real b0,
Real kB 
) const

Definition at line 1282 of file GromacsTopFile.C.

01283                                                                      {
01284   int i;
01285   for(i=0;i<b0Array.size();i++) {
01286     if(typeaArray[i] == NULL || typebArray[i] == NULL) continue;
01287     if( (0==strcmp(typea,typeaArray[i]) &&
01288          0==strcmp(typeb,typebArray[i]))
01289      || (0==strcmp(typeb,typeaArray[i]) &&
01290          0==strcmp(typea,typebArray[i]))
01291      && funct==functArray[i]) {
01292       *b0 = b0Array[i];
01293       *kB = kBArray[i];
01294       return i;
01295     }
01296   }
01297   return -1;
01298 }

void BondTable::getParams ( int  num,
Real b0,
Real kB,
int *  funct 
) const

Definition at line 1109 of file GromacsTopFile.C.

Referenced by GromacsTopFile::getBondParams(), and GromacsTopFile::GromacsTopFile().

01110         {
01111   *b0=b0Array[num];
01112   *kB=kBArray[num];
01113   *funct=functArray[num];
01114 }

int BondTable::size (  )  const [inline]

Definition at line 245 of file GromacsTopFile.h.

Referenced by GromacsTopFile::getNumBondParams().

00245 { return b0Array.size(); }


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 01:17:17 2017 for NAMD by  doxygen 1.4.7