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

#include <GromacsTopFile.h>

Public Member Functions

int size () const
 
int getIndex (Real th0, Real kth, int funct)
 
void addType (const char *typea, const char *typeb, const char *typec, Real th0, Real kth, int funct)
 
void getParams (int num, Real *th0, Real *kth, int *funct) const
 
int getParams (const char *typea, const char *typeb, const char *typec, int funct, Real *th0, Real *kth) const
 

Detailed Description

Definition at line 276 of file GromacsTopFile.h.

Member Function Documentation

void AngleTable::addType ( const char *  typea,
const char *  typeb,
const char *  typec,
Real  th0,
Real  kth,
int  funct 
)

Definition at line 1154 of file GromacsTopFile.C.

References ResizeArray< T >::add().

Referenced by GromacsTopFile::GromacsTopFile().

1155  {
1156  typeaArray.add(strdup(typea));
1157  typebArray.add(strdup(typeb));
1158  typecArray.add(strdup(typec));
1159  th0Array.add(th0);
1160  kthArray.add(kth);
1161  functArray.add(funct);
1162 }
int add(const Elem &elem)
Definition: ResizeArray.h:97
int AngleTable::getIndex ( Real  th0,
Real  kth,
int  funct 
)

Definition at line 1016 of file GromacsTopFile.C.

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

Referenced by GromacsTopFile::GromacsTopFile().

1016  {
1017  /* check to see if it is in the table already */
1018  int i;
1019  for(i=0;i<th0Array.size();i++) {
1020  if(fabs(th0-th0Array[i])<0.00001 &&
1021  fabs(kth-kthArray[i])<0.00001 &&
1022  funct == functArray[i]) {
1023  return i;
1024  }
1025  }
1026 
1027  /* nope, it wasn't in the table add a new element! */
1028  th0Array.add(th0);
1029  kthArray.add(kth);
1030  functArray.add(funct);
1031  typeaArray.add(NULL);
1032  typebArray.add(NULL);
1033  typecArray.add(NULL);
1034  return th0Array.size()-1;
1035 }
int add(const Elem &elem)
Definition: ResizeArray.h:97
int size(void) const
Definition: ResizeArray.h:127
void AngleTable::getParams ( int  num,
Real th0,
Real kth,
int *  funct 
) const

Definition at line 1118 of file GromacsTopFile.C.

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

1119  {
1120  *th0=th0Array[num];
1121  *kth=kthArray[num];
1122  *funct=functArray[num];
1123 }
int AngleTable::getParams ( const char *  typea,
const char *  typeb,
const char *  typec,
int  funct,
Real th0,
Real kth 
) const

Definition at line 1204 of file GromacsTopFile.C.

References ResizeArray< T >::size().

1206  {
1207  int i;
1208  for(i=0;i<th0Array.size();i++) {
1209  if(typeaArray[i] == NULL || typebArray[i] == NULL
1210  || typecArray[i] == NULL) continue;
1211  if( (0==strcmp(typea,typeaArray[i]) && /* A--B--C */
1212  0==strcmp(typeb,typebArray[i]) &&
1213  0==strcmp(typec,typecArray[i])) /* or */
1214  || (0==strcmp(typec,typeaArray[i]) &&
1215  0==strcmp(typeb,typebArray[i]) && /* C--B--A */
1216  0==strcmp(typea,typecArray[i]))
1217  && funct==functArray[i]) {
1218  *th0 = th0Array[i];
1219  *kth = kthArray[i];
1220  return i;
1221  }
1222  }
1223  return -1;
1224 }
int size(void) const
Definition: ResizeArray.h:127
int AngleTable::size ( ) const
inline

Definition at line 288 of file GromacsTopFile.h.

References ResizeArray< T >::size().

Referenced by GromacsTopFile::getNumAngleParams().

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

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