Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

AtomSignature Class Reference

#include <structures.h>

List of all members.

Public Member Functions

 AtomSignature ()
 AtomSignature (const AtomSignature &sig)
AtomSignatureoperator= (const AtomSignature &sig)
int operator== (const AtomSignature &sig) const
 ~AtomSignature ()
void removeEmptyTupleSigs ()
void pack (MOStream *msg)
void unpack (MIStream *msg)

Public Attributes

int bondCnt
int angleCnt
int dihedralCnt
int improperCnt
int crosstermCnt
TupleSignaturebondSigs
TupleSignatureangleSigs
TupleSignaturedihedralSigs
TupleSignatureimproperSigs
TupleSignaturecrosstermSigs


Constructor & Destructor Documentation

AtomSignature::AtomSignature  )  [inline]
 

Definition at line 256 of file structures.h.

00256                    {
00257         bondCnt=angleCnt=dihedralCnt=improperCnt=crosstermCnt=0;
00258         bondSigs = NULL;
00259         angleSigs = NULL;
00260         dihedralSigs = NULL;
00261         improperSigs = NULL;
00262         crosstermSigs = NULL;
00263     }

AtomSignature::AtomSignature const AtomSignature sig  )  [inline]
 

Definition at line 264 of file structures.h.

References angleCnt, angleSigs, bondCnt, bondSigs, crosstermCnt, crosstermSigs, dihedralCnt, dihedralSigs, improperCnt, and improperSigs.

00264                                            {
00265         bondSigs = NULL;
00266         angleSigs = NULL;
00267         dihedralSigs = NULL;
00268         improperSigs = NULL;
00269         crosstermSigs = NULL;
00270 
00271         bondCnt = sig.bondCnt;
00272         if(bondCnt>0){            
00273             bondSigs = new TupleSignature[bondCnt];
00274             for(int i=0; i<bondCnt; i++)
00275                 bondSigs[i] = sig.bondSigs[i];
00276         }
00277 
00278         angleCnt = sig.angleCnt;
00279         if(angleCnt>0){            
00280             angleSigs = new TupleSignature[angleCnt];
00281             for(int i=0; i<angleCnt; i++)
00282                 angleSigs[i] = sig.angleSigs[i];
00283         }
00284         
00285         dihedralCnt = sig.dihedralCnt;
00286         if(dihedralCnt>0){            
00287             dihedralSigs = new TupleSignature[dihedralCnt];
00288             for(int i=0; i<dihedralCnt; i++)
00289                 dihedralSigs[i] = sig.dihedralSigs[i];
00290         }
00291         
00292         improperCnt = sig.improperCnt;
00293         if(improperCnt>0){
00294             improperSigs = new TupleSignature[improperCnt];
00295             for(int i=0; i<improperCnt; i++)
00296                 improperSigs[i] = sig.improperSigs[i];
00297         }      
00298 
00299         crosstermCnt = sig.crosstermCnt;
00300         if(crosstermCnt>0){
00301             crosstermSigs = new TupleSignature[crosstermCnt];
00302             for(int i=0; i<crosstermCnt; i++)
00303                 crosstermSigs[i] = sig.crosstermSigs[i];
00304         }        
00305     }

AtomSignature::~AtomSignature  )  [inline]
 

Definition at line 374 of file structures.h.

00374                     {
00375         if(bondSigs) delete[] bondSigs;
00376         if(angleSigs) delete[] angleSigs;
00377         if(dihedralSigs) delete[] dihedralSigs;
00378         if(improperSigs) delete[] improperSigs;
00379         if(crosstermSigs) delete[] crosstermSigs;
00380     }    


Member Function Documentation

AtomSignature& AtomSignature::operator= const AtomSignature sig  )  [inline]
 

Definition at line 306 of file structures.h.

References angleCnt, angleSigs, bondCnt, bondSigs, crosstermCnt, crosstermSigs, dihedralCnt, dihedralSigs, improperCnt, and improperSigs.

00306                                                       {        
00307         bondCnt = sig.bondCnt;
00308         if(bondSigs) delete [] bondSigs;
00309         if(bondCnt>0){
00310             bondSigs = new TupleSignature[bondCnt];
00311             for(int i=0; i<bondCnt; i++)
00312                 bondSigs[i] = sig.bondSigs[i];
00313         }else
00314             bondSigs = NULL;
00315 
00316         angleCnt = sig.angleCnt;
00317         if(angleSigs) delete [] angleSigs;
00318         if(angleCnt>0){
00319             angleSigs = new TupleSignature[angleCnt];
00320             for(int i=0; i<angleCnt; i++)
00321                 angleSigs[i] = sig.angleSigs[i];
00322         }else
00323             angleSigs = NULL;
00324         
00325         dihedralCnt = sig.dihedralCnt;
00326         if(dihedralSigs) delete [] dihedralSigs;
00327         if(dihedralCnt>0){
00328             dihedralSigs = new TupleSignature[dihedralCnt];
00329             for(int i=0; i<dihedralCnt; i++)
00330                 dihedralSigs[i] = sig.dihedralSigs[i];
00331         }else
00332             dihedralSigs = NULL;
00333         
00334         improperCnt = sig.improperCnt;
00335         if(improperSigs) delete [] improperSigs;
00336         if(improperCnt>0){
00337             improperSigs = new TupleSignature[improperCnt];
00338             for(int i=0; i<improperCnt; i++)
00339                 improperSigs[i] = sig.improperSigs[i];
00340         }else
00341             improperSigs = NULL;      
00342 
00343         crosstermCnt = sig.crosstermCnt;
00344         if(crosstermSigs) delete [] crosstermSigs;
00345         if(crosstermCnt>0){
00346             crosstermSigs = new TupleSignature[crosstermCnt];
00347             for(int i=0; i<crosstermCnt; i++)
00348                 crosstermSigs[i] = sig.crosstermSigs[i];
00349         }else
00350             crosstermSigs = NULL;
00351 
00352         return *this;
00353     }

int AtomSignature::operator== const AtomSignature sig  )  const [inline]
 

Definition at line 354 of file structures.h.

References angleCnt, bondCnt, CMPSIGS, crosstermCnt, dihedralCnt, and improperCnt.

00354                                                   {
00355             if(bondCnt!=sig.bondCnt) return 0;
00356             if(angleCnt!=sig.angleCnt) return 0;
00357             if(dihedralCnt!=sig.dihedralCnt) return 0;
00358             if(improperCnt!=sig.improperCnt) return 0;
00359             if(crosstermCnt!=sig.crosstermCnt) return 0;
00360         
00361         #define CMPSIGS(TUPLE) \
00362         for(int i=0; i<sig.TUPLE##Cnt; i++){ \
00363             if(!(TUPLE##Sigs[i]==sig.TUPLE##Sigs[i])) return 0; \
00364         } \
00365         
00366             CMPSIGS(bond)
00367             CMPSIGS(angle)
00368             CMPSIGS(dihedral)
00369             CMPSIGS(improper)
00370             CMPSIGS(crossterm)
00371         
00372             return 1;
00373         }

void AtomSignature::pack MOStream msg  ) 
 

Definition at line 8249 of file Molecule.C.

References angleCnt, angleSigs, bondCnt, bondSigs, crosstermCnt, crosstermSigs, dihedralCnt, dihedralSigs, improperCnt, improperSigs, TupleSignature::pack(), and MOStream::put().

08249                                      {
08250     msg->put(bondCnt);
08251     for(int i=0; i<bondCnt; i++)
08252         bondSigs[i].pack(msg);
08253 
08254     msg->put(angleCnt);
08255     for(int i=0; i<angleCnt; i++)
08256         angleSigs[i].pack(msg);
08257 
08258     msg->put(dihedralCnt);
08259     for(int i=0; i<dihedralCnt; i++)
08260         dihedralSigs[i].pack(msg);
08261 
08262     msg->put(improperCnt);
08263     for(int i=0; i<improperCnt; i++)
08264         improperSigs[i].pack(msg);
08265 
08266     msg->put(crosstermCnt);
08267     for(int i=0; i<crosstermCnt; i++)
08268         crosstermSigs[i].pack(msg);
08269 }

void AtomSignature::removeEmptyTupleSigs  ) 
 

Definition at line 8318 of file Molecule.C.

References angleCnt, angleSigs, bondCnt, bondSigs, crosstermCnt, crosstermSigs, dihedralCnt, dihedralSigs, improperCnt, improperSigs, and TupleSignature::isEmpty().

08318                                         {
08319     int origTupleCnt;
08320     int idx;
08321     TupleSignature *tupleSigs;
08322     TupleSignature *newTupleSigs;
08323 
08324     //bonds
08325     origTupleCnt = bondCnt;
08326     tupleSigs= bondSigs;
08327     for(int i=0; i<origTupleCnt; i++){
08328         if(tupleSigs[i].isEmpty())
08329             bondCnt--;
08330     }
08331     if(bondCnt==0){
08332         delete [] tupleSigs;
08333         bondSigs = NULL;
08334     }else if(bondCnt!=origTupleCnt){
08335         newTupleSigs = new TupleSignature[bondCnt];
08336         idx=0;
08337         for(int i=0; i<origTupleCnt; i++){
08338             if(!tupleSigs[i].isEmpty()){
08339                 newTupleSigs[idx] = tupleSigs[i];
08340                 idx++;
08341             }
08342         }
08343         delete [] tupleSigs;
08344         bondSigs = newTupleSigs;
08345     }
08346 
08347     //angles
08348     origTupleCnt = angleCnt;
08349     tupleSigs = angleSigs;
08350     for(int i=0; i<origTupleCnt; i++){
08351         if(tupleSigs[i].isEmpty())
08352             angleCnt--;
08353     }
08354     if(angleCnt==0){
08355         delete [] tupleSigs;
08356         angleSigs = NULL;
08357     }else if(angleCnt!=origTupleCnt){
08358         newTupleSigs = new TupleSignature[angleCnt];
08359         idx=0;
08360         for(int i=0; i<origTupleCnt; i++){
08361             if(!tupleSigs[i].isEmpty()){
08362                 newTupleSigs[idx] = tupleSigs[i];
08363                 idx++;
08364             }
08365         }
08366         delete [] tupleSigs;
08367         angleSigs = newTupleSigs;
08368     }
08369 
08370     //dihedrals
08371     origTupleCnt = dihedralCnt;
08372     tupleSigs = dihedralSigs;
08373     for(int i=0; i<origTupleCnt; i++){
08374         if(tupleSigs[i].isEmpty())
08375             dihedralCnt--;
08376     }
08377     if(dihedralCnt==0){
08378         delete [] tupleSigs;
08379         dihedralSigs = NULL;
08380     }else if(dihedralCnt!=origTupleCnt){
08381         newTupleSigs = new TupleSignature[dihedralCnt];
08382         idx=0;
08383         for(int i=0; i<origTupleCnt; i++){
08384             if(!tupleSigs[i].isEmpty()){
08385                 newTupleSigs[idx] = tupleSigs[i];
08386                 idx++;
08387             }
08388         }
08389         delete [] tupleSigs;
08390         dihedralSigs = newTupleSigs;        
08391     }
08392 
08393 
08394     //impropers
08395     origTupleCnt = improperCnt;
08396     tupleSigs = improperSigs;
08397     for(int i=0; i<origTupleCnt; i++){
08398         if(tupleSigs[i].isEmpty())
08399             improperCnt--;
08400     }
08401     if(improperCnt==0){
08402         delete [] tupleSigs;
08403         improperSigs = NULL;
08404     }else if(improperCnt!=origTupleCnt){
08405         newTupleSigs = new TupleSignature[improperCnt];
08406         idx=0;
08407         for(int i=0; i<origTupleCnt; i++){
08408             if(!tupleSigs[i].isEmpty()){
08409                 newTupleSigs[idx] = tupleSigs[i];
08410                 idx++;
08411             }
08412         }
08413         delete [] tupleSigs;
08414         improperSigs = newTupleSigs;
08415     }    
08416 
08417     //crossterms
08418     origTupleCnt = crosstermCnt;
08419     tupleSigs = crosstermSigs;
08420     for(int i=0; i<origTupleCnt; i++){
08421         if(tupleSigs[i].isEmpty())
08422             crosstermCnt--;
08423     }
08424     if(crosstermCnt==0){
08425         delete [] tupleSigs;
08426         crosstermSigs = NULL;
08427     }else if(crosstermCnt!=origTupleCnt){
08428         newTupleSigs = new TupleSignature[crosstermCnt];
08429         idx=0;
08430         for(int i=0; i<origTupleCnt; i++){
08431             if(!tupleSigs[i].isEmpty()){
08432                 newTupleSigs[idx] = tupleSigs[i];
08433                 idx++;
08434             }
08435         }
08436         delete [] tupleSigs;
08437         crosstermSigs = newTupleSigs;
08438     }    
08439 }

void AtomSignature::unpack MIStream msg  ) 
 

Definition at line 8271 of file Molecule.C.

References angleCnt, angleSigs, bondCnt, bondSigs, crosstermCnt, crosstermSigs, dihedralCnt, dihedralSigs, MIStream::get(), improperCnt, improperSigs, and TupleSignature::unpack().

08271                                        {
08272     msg->get(bondCnt);
08273     delete [] bondSigs;
08274     bondSigs = NULL;
08275     if(bondCnt>0){
08276         bondSigs = new TupleSignature[bondCnt];
08277         for(int i=0; i<bondCnt; i++)
08278             bondSigs[i].unpack(msg);
08279     }
08280 
08281     msg->get(angleCnt);
08282     delete [] angleSigs;
08283     angleSigs = NULL;
08284     if(angleCnt>0){
08285         angleSigs = new TupleSignature[angleCnt];
08286         for(int i=0; i<angleCnt; i++)
08287             angleSigs[i].unpack(msg);
08288     }
08289 
08290     msg->get(dihedralCnt);
08291     delete [] dihedralSigs;
08292     dihedralSigs = NULL;
08293     if(dihedralCnt>0){
08294         dihedralSigs = new TupleSignature[dihedralCnt];
08295         for(int i=0; i<dihedralCnt; i++)
08296             dihedralSigs[i].unpack(msg);
08297     }
08298 
08299     msg->get(improperCnt);
08300     delete [] improperSigs;
08301     improperSigs = NULL;
08302     if(improperCnt>0){
08303         improperSigs = new TupleSignature[improperCnt];
08304         for(int i=0; i<improperCnt; i++)
08305             improperSigs[i].unpack(msg);
08306     }
08307 
08308     msg->get(crosstermCnt);
08309     delete [] crosstermSigs;
08310     crosstermSigs = NULL;
08311     if(crosstermCnt>0){
08312         crosstermSigs = new TupleSignature[crosstermCnt];
08313         for(int i=0; i<crosstermCnt; i++)
08314             crosstermSigs[i].unpack(msg);
08315     }
08316 }


Member Data Documentation

int AtomSignature::angleCnt
 

Definition at line 245 of file structures.h.

Referenced by AtomSignature(), dumpbench(), AngleElem::getTupleInfo(), operator=(), operator==(), pack(), removeEmptyTupleSigs(), and unpack().

TupleSignature* AtomSignature::angleSigs
 

Definition at line 251 of file structures.h.

Referenced by AtomSignature(), dumpbench(), AngleElem::getTupleInfo(), operator=(), pack(), removeEmptyTupleSigs(), and unpack().

int AtomSignature::bondCnt
 

Definition at line 244 of file structures.h.

Referenced by AtomSignature(), dumpbench(), BondElem::getTupleInfo(), operator=(), operator==(), pack(), Molecule::print_bonds(), removeEmptyTupleSigs(), and unpack().

TupleSignature* AtomSignature::bondSigs
 

Definition at line 250 of file structures.h.

Referenced by AtomSignature(), dumpbench(), BondElem::getTupleInfo(), operator=(), pack(), Molecule::print_bonds(), removeEmptyTupleSigs(), and unpack().

int AtomSignature::crosstermCnt
 

Definition at line 248 of file structures.h.

Referenced by AtomSignature(), CrosstermElem::getTupleInfo(), operator=(), operator==(), pack(), removeEmptyTupleSigs(), and unpack().

TupleSignature* AtomSignature::crosstermSigs
 

Definition at line 254 of file structures.h.

Referenced by AtomSignature(), CrosstermElem::getTupleInfo(), operator=(), pack(), removeEmptyTupleSigs(), and unpack().

int AtomSignature::dihedralCnt
 

Definition at line 246 of file structures.h.

Referenced by AtomSignature(), dumpbench(), DihedralElem::getTupleInfo(), operator=(), operator==(), pack(), removeEmptyTupleSigs(), and unpack().

TupleSignature* AtomSignature::dihedralSigs
 

Definition at line 252 of file structures.h.

Referenced by AtomSignature(), dumpbench(), DihedralElem::getTupleInfo(), operator=(), pack(), removeEmptyTupleSigs(), and unpack().

int AtomSignature::improperCnt
 

Definition at line 247 of file structures.h.

Referenced by AtomSignature(), dumpbench(), ImproperElem::getTupleInfo(), operator=(), operator==(), pack(), removeEmptyTupleSigs(), and unpack().

TupleSignature* AtomSignature::improperSigs
 

Definition at line 253 of file structures.h.

Referenced by AtomSignature(), dumpbench(), ImproperElem::getTupleInfo(), operator=(), pack(), removeEmptyTupleSigs(), and unpack().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 04:07:43 2008 for NAMD by  doxygen 1.3.9.1