--- branches/new_design/OOPSE-4/src/UseTheForce/DUFF.cpp 2004/10/28 22:34:02 1683 +++ branches/new_design/OOPSE-4/src/UseTheForce/DUFF.cpp 2004/11/03 18:00:36 1702 @@ -109,7 +109,7 @@ namespace DUFF_NS { // restrict the access of the fol } ~LinkedAtomType(){ if( next != NULL ) delete next; } - LinkedAtomType* find(char* key){ + LinkedAtomType* find(const char* key){ if( !strcmp(name, key) ) return this; if( next != NULL ) return next->find(key); return NULL; @@ -207,7 +207,7 @@ namespace DUFF_NS { // restrict the access of the fol } ~LinkedBondType(){ if( next != NULL ) delete next; } - LinkedBondType* find(char* key1, char* key2){ + LinkedBondType* find(const char* key1, const char* key2){ if( !strcmp(nameA, key1 ) && !strcmp( nameB, key2 ) ) return this; if( !strcmp(nameA, key2 ) && !strcmp( nameB, key1 ) ) return this; if( next != NULL ) return next->find(key1, key2); @@ -277,7 +277,7 @@ namespace DUFF_NS { // restrict the access of the fol } ~LinkedBendType(){ if( next != NULL ) delete next; } - LinkedBendType* find( char* key1, char* key2, char* key3 ){ + LinkedBendType* find(const char* key1, const char* key2, const char* key3 ){ if( !strcmp( nameA, key1 ) && !strcmp( nameB, key2 ) && !strcmp( nameC, key3 ) ) return this; if( !strcmp( nameA, key3 ) && !strcmp( nameB, key2 ) @@ -355,7 +355,7 @@ namespace DUFF_NS { // restrict the access of the fol } ~LinkedTorsionType(){ if( next != NULL ) delete next; } - LinkedTorsionType* find( char* key1, char* key2, char* key3, char* key4 ){ + LinkedTorsionType* find(const char* key1, const char* key2, const char* key3, const char* key4 ){ @@ -1134,11 +1134,11 @@ void DUFF::initializeAtoms( int nAtoms, Atom** the_ato for(int i=0; ifind( the_atoms[i]->getType() ); + currentAtomType = headAtomType->find(the_atoms[i]->getType().c_str() ); if( currentAtomType == NULL ){ sprintf( painCave.errMsg, "AtomType error, %s not found in force file.\n", - the_atoms[i]->getType() ); + the_atoms[i]->getType().c_str() ); painCave.isFatal = 1; simError(); } @@ -1160,16 +1160,16 @@ void DUFF::initializeAtoms( int nAtoms, Atom** the_ato dAtom->setJ( ji ); - if(!strcmp("SSD",the_atoms[i]->getType())){ + if(!strcmp("SSD",the_atoms[i]->getType().c_str())){ dAtom->setI( waterI ); } - else if(!strcmp("HEAD",the_atoms[i]->getType())){ + else if(!strcmp("HEAD",the_atoms[i]->getType().c_str())){ dAtom->setI( headI ); } else{ sprintf(painCave.errMsg, "AtmType error, %s does not have a moment of inertia set.\n", - the_atoms[i]->getType() ); + the_atoms[i]->getType().c_str() ); painCave.isFatal = 1; simError(); } @@ -1201,9 +1201,7 @@ void DUFF::initializeBonds( int nBonds, Bond** bondArr void DUFF::initializeBonds( int nBonds, Bond** bondArray, bond_pair* the_bonds ){ int i,a,b; - char* atomA; - char* atomB; - + Atom** the_atoms; the_atoms = entry_plug->atoms; @@ -1215,13 +1213,11 @@ void DUFF::initializeBonds( int nBonds, Bond** bondArr a = the_bonds[i].a; b = the_bonds[i].b; - atomA = the_atoms[a]->getType(); - atomB = the_atoms[b]->getType(); - currentBondType = headBondType->find( atomA, atomB ); + currentBondType = headBondType->find( the_atoms[a]->getType().c_str(), the_atoms[b]->getType().c_str() ); if( currentBondType == NULL ){ sprintf( painCave.errMsg, "BondType error, %s - %s not found in force file.\n", - atomA, atomB ); + the_atoms[a]->getType().c_str(), the_atoms[b]->getType().c_str() ); painCave.isFatal = 1; simError(); } @@ -1261,9 +1257,9 @@ void DUFF::initializeBends( int nBends, Bend** bendArr the_atoms = entry_plug->atoms; int i, a, b, c; - char* atomA; - char* atomB; - char* atomC; + string atomA; + string atomB; + string atomC; // initialize the Bends @@ -1279,11 +1275,11 @@ void DUFF::initializeBends( int nBends, Bend** bendArr if( the_bends[i].isGhost ) atomC = "GHOST"; else atomC = the_atoms[c]->getType(); - currentBendType = headBendType->find( atomA, atomB, atomC ); + currentBendType = headBendType->find( atomA.c_str(), atomB.c_str(), atomC.c_str()); if( currentBendType == NULL ){ sprintf( painCave.errMsg, "BendType error, %s - %s - %s not found" " in force file.\n", - atomA, atomB, atomC ); + atomA.c_str(), atomB.c_str(), atomC.c_str() ); painCave.isFatal = 1; simError(); } @@ -1306,7 +1302,7 @@ void DUFF::initializeBends( int nBends, Bend** bendArr " --> central atom is not " "correctly identified with the " "\"ghostVectorSource = \" tag.\n", - atomA, atomB, atomC ); + atomA.c_str(), atomB.c_str(), atomC.c_str() ); painCave.isFatal = 1; simError(); } @@ -1338,10 +1334,6 @@ void DUFF::initializeTorsions( int nTorsions, Torsion* torsion_set* the_torsions ){ int i, a, b, c, d; - char* atomA; - char* atomB; - char* atomC; - char* atomD; CubicTorsion* cTors; Atom** the_atoms; @@ -1356,16 +1348,18 @@ void DUFF::initializeTorsions( int nTorsions, Torsion* c = the_torsions[i].c; d = the_torsions[i].d; - atomA = the_atoms[a]->getType(); - atomB = the_atoms[b]->getType(); - atomC = the_atoms[c]->getType(); - atomD = the_atoms[d]->getType(); - currentTorsionType = headTorsionType->find( atomA, atomB, atomC, atomD ); + currentTorsionType = headTorsionType->find( the_atoms[a]->getType().c_str(), + the_atoms[b]->getType().c_str(), + the_atoms[c]->getType().c_str(), + the_atoms[d]->getType().c_str() ); if( currentTorsionType == NULL ){ sprintf( painCave.errMsg, "TorsionType error, %s - %s - %s - %s not found" " in force file.\n", - atomA, atomB, atomC, atomD ); + the_atoms[a]->getType().c_str(), + the_atoms[b]->getType().c_str(), + the_atoms[c]->getType().c_str(), + the_atoms[d]->getType().c_str() ); painCave.isFatal = 1; simError(); }