NAMD
Public Member Functions | List of all members
BondTable Class Reference

#include <GromacsTopFile.h>

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< T >::add().

Referenced by GromacsTopFile::GromacsTopFile().

1272  {
1273  b0Array.add(b0);
1274  kBArray.add(kB);
1275  functArray.add(funct);
1276  typeaArray.add(strdup(typea));
1277  typebArray.add(strdup(typeb));
1278 }
int add(const Elem &elem)
Definition: ResizeArray.h:97
int BondTable::getIndex ( Real  b0,
Real  kB,
int  funct 
)

Definition at line 990 of file GromacsTopFile.C.

References ResizeArray< T >::add(), and ResizeArray< T >::size().

Referenced by GromacsTopFile::GromacsTopFile().

990  {
991  /* check to see if it is in the table already */
992  int i;
993  for(i=0;i<b0Array.size();i++) {
994  if(fabs(b0-b0Array[i])<0.00001 &&
995  fabs(kB-kBArray[i])<0.00001 &&
996  funct == functArray[i]) {
997  return i;
998  }
999  }
1000 
1001  /* nope, it wasn't in the table add a new element! */
1002  b0Array.add(b0);
1003  kBArray.add(kB);
1004  functArray.add(funct);
1005  typeaArray.add(NULL);
1006  typebArray.add(NULL);
1007  return b0Array.size()-1;
1008 }
int add(const Elem &elem)
Definition: ResizeArray.h:97
int size(void) const
Definition: ResizeArray.h:127
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().

1110  {
1111  *b0=b0Array[num];
1112  *kB=kBArray[num];
1113  *funct=functArray[num];
1114 }
int BondTable::getParams ( const char *  typea,
const char *  typeb,
int  funct,
Real b0,
Real kB 
) const

Definition at line 1282 of file GromacsTopFile.C.

References ResizeArray< T >::size().

1283  {
1284  int i;
1285  for(i=0;i<b0Array.size();i++) {
1286  if(typeaArray[i] == NULL || typebArray[i] == NULL) continue;
1287  if( (0==strcmp(typea,typeaArray[i]) &&
1288  0==strcmp(typeb,typebArray[i]))
1289  || (0==strcmp(typeb,typeaArray[i]) &&
1290  0==strcmp(typea,typebArray[i]))
1291  && funct==functArray[i]) {
1292  *b0 = b0Array[i];
1293  *kB = kBArray[i];
1294  return i;
1295  }
1296  }
1297  return -1;
1298 }
int size(void) const
Definition: ResizeArray.h:127
int BondTable::size ( ) const
inline

Definition at line 245 of file GromacsTopFile.h.

References ResizeArray< T >::size().

Referenced by GromacsTopFile::getNumBondParams().

245 { return b0Array.size(); }
int size(void) const
Definition: ResizeArray.h:127

The documentation for this class was generated from the following files: