AngleTable Class Reference

#include <GromacsTopFile.h>

List of all members.

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

Referenced by GromacsTopFile::GromacsTopFile().

01155                                                                       {
01156   typeaArray.add(strdup(typea));
01157   typebArray.add(strdup(typeb));
01158   typecArray.add(strdup(typec));
01159   th0Array.add(th0);
01160   kthArray.add(kth);
01161   functArray.add(funct);
01162 }

int AngleTable::getIndex ( Real  th0,
Real  kth,
int  funct 
)

Definition at line 1016 of file GromacsTopFile.C.

References ResizeArray< Elem >::add().

Referenced by GromacsTopFile::GromacsTopFile().

01016                                                         {
01017   /* check to see if it is in the table already */
01018   int i;
01019   for(i=0;i<th0Array.size();i++) {
01020     if(fabs(th0-th0Array[i])<0.00001 &&
01021        fabs(kth-kthArray[i])<0.00001 &&
01022        funct == functArray[i]) {
01023       return i;
01024     }
01025   }
01026   
01027   /* nope, it wasn't in the table add a new element! */
01028   th0Array.add(th0);
01029   kthArray.add(kth);
01030   functArray.add(funct);
01031   typeaArray.add(NULL);
01032   typebArray.add(NULL);
01033   typecArray.add(NULL);
01034   return th0Array.size()-1;
01035 }

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.

01206                                                  {
01207   int i;
01208   for(i=0;i<th0Array.size();i++) {
01209     if(typeaArray[i] == NULL || typebArray[i] == NULL
01210        || typecArray[i] == NULL) continue;
01211     if( (0==strcmp(typea,typeaArray[i]) &&  /* A--B--C */
01212          0==strcmp(typeb,typebArray[i]) &&
01213          0==strcmp(typec,typecArray[i]))    /* or */
01214      || (0==strcmp(typec,typeaArray[i]) &&
01215          0==strcmp(typeb,typebArray[i]) &&  /* C--B--A */
01216          0==strcmp(typea,typecArray[i]))
01217      && funct==functArray[i]) {
01218       *th0 = th0Array[i];
01219       *kth = kthArray[i];
01220       return i;
01221     }
01222   }
01223   return -1;
01224 }

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().

01119         {
01120   *th0=th0Array[num];
01121   *kth=kthArray[num];
01122   *funct=functArray[num];
01123 }

int AngleTable::size (  )  const [inline]

Definition at line 288 of file GromacsTopFile.h.

Referenced by GromacsTopFile::getNumAngleParams().

00288 { return th0Array.size(); }


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