ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/UseTheForce/DUFF.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/UseTheForce/DUFF.cpp (file contents):
Revision 1683, Thu Oct 28 22:34:02 2004 UTC vs.
Revision 1702 by tim, Wed Nov 3 18:00:36 2004 UTC

# Line 109 | Line 109 | namespace DUFF_NS {  // restrict the access of the fol
109      }
110      ~LinkedAtomType(){ if( next != NULL ) delete next; }
111  
112 <    LinkedAtomType* find(char* key){
112 >    LinkedAtomType* find(const char* key){
113        if( !strcmp(name, key) ) return this;
114        if( next != NULL ) return next->find(key);
115        return NULL;
# Line 207 | Line 207 | namespace DUFF_NS {  // restrict the access of the fol
207      }
208      ~LinkedBondType(){ if( next != NULL ) delete next; }
209  
210 <    LinkedBondType* find(char* key1, char* key2){
210 >    LinkedBondType* find(const char* key1, const char* key2){
211        if( !strcmp(nameA, key1 ) && !strcmp( nameB, key2 ) ) return this;
212        if( !strcmp(nameA, key2 ) && !strcmp( nameB, key1 ) ) return this;
213        if( next != NULL ) return next->find(key1, key2);
# Line 277 | Line 277 | namespace DUFF_NS {  // restrict the access of the fol
277      }
278      ~LinkedBendType(){ if( next != NULL ) delete next; }
279  
280 <    LinkedBendType* find( char* key1, char* key2, char* key3 ){
280 >    LinkedBendType* find(const char* key1, const char* key2, const char* key3 ){
281        if( !strcmp( nameA, key1 ) && !strcmp( nameB, key2 )
282            && !strcmp( nameC, key3 ) ) return this;
283        if( !strcmp( nameA, key3 ) && !strcmp( nameB, key2 )
# Line 355 | Line 355 | namespace DUFF_NS {  // restrict the access of the fol
355      }
356      ~LinkedTorsionType(){ if( next != NULL ) delete next; }
357  
358 <    LinkedTorsionType* find( char* key1, char* key2, char* key3, char* key4 ){
358 >    LinkedTorsionType* find(const char* key1, const char* key2, const char* key3, const char* key4 ){
359        
360  
361  
# Line 1134 | Line 1134 | void DUFF::initializeAtoms( int nAtoms, Atom** the_ato
1134  
1135    for(int i=0; i<nAtoms; i++ ){
1136  
1137 <    currentAtomType = headAtomType->find( the_atoms[i]->getType() );
1137 >    currentAtomType = headAtomType->find(the_atoms[i]->getType().c_str() );
1138      if( currentAtomType == NULL ){
1139        sprintf( painCave.errMsg,
1140                 "AtomType error, %s not found in force file.\n",
1141 <               the_atoms[i]->getType() );
1141 >               the_atoms[i]->getType().c_str() );
1142        painCave.isFatal = 1;
1143        simError();
1144      }
# Line 1160 | Line 1160 | void DUFF::initializeAtoms( int nAtoms, Atom** the_ato
1160  
1161          dAtom->setJ( ji );
1162          
1163 <        if(!strcmp("SSD",the_atoms[i]->getType())){
1163 >        if(!strcmp("SSD",the_atoms[i]->getType().c_str())){
1164            dAtom->setI( waterI );
1165          }
1166 <        else if(!strcmp("HEAD",the_atoms[i]->getType())){
1166 >        else if(!strcmp("HEAD",the_atoms[i]->getType().c_str())){
1167            dAtom->setI( headI );
1168          }
1169          else{
1170            sprintf(painCave.errMsg,
1171                    "AtmType error, %s does not have a moment of inertia set.\n",
1172 <                  the_atoms[i]->getType() );
1172 >                  the_atoms[i]->getType().c_str() );
1173            painCave.isFatal = 1;
1174            simError();
1175          }
# Line 1201 | Line 1201 | void DUFF::initializeBonds( int nBonds, Bond** bondArr
1201   void DUFF::initializeBonds( int nBonds, Bond** bondArray,
1202                                     bond_pair* the_bonds ){
1203    int i,a,b;
1204 <  char* atomA;
1205 <  char* atomB;
1206 <  
1204 >
1205    Atom** the_atoms;
1206    the_atoms = entry_plug->atoms;
1207    
# Line 1215 | Line 1213 | void DUFF::initializeBonds( int nBonds, Bond** bondArr
1213      a = the_bonds[i].a;
1214      b = the_bonds[i].b;
1215  
1216 <    atomA = the_atoms[a]->getType();
1219 <    atomB = the_atoms[b]->getType();
1220 <    currentBondType = headBondType->find( atomA, atomB );
1216 >    currentBondType = headBondType->find(  the_atoms[a]->getType().c_str(),  the_atoms[b]->getType().c_str() );
1217      if( currentBondType == NULL ){
1218        sprintf( painCave.errMsg,
1219                 "BondType error, %s - %s not found in force file.\n",
1220 <               atomA, atomB );
1220 >               the_atoms[a]->getType().c_str(),  the_atoms[b]->getType().c_str() );
1221        painCave.isFatal = 1;
1222        simError();
1223      }
# Line 1261 | Line 1257 | void DUFF::initializeBends( int nBends, Bend** bendArr
1257    the_atoms = entry_plug->atoms;
1258    
1259    int i, a, b, c;
1260 <  char* atomA;
1261 <  char* atomB;
1262 <  char* atomC;
1260 >  string atomA;
1261 >  string atomB;
1262 >  string atomC;
1263    
1264    // initialize the Bends
1265  
# Line 1279 | Line 1275 | void DUFF::initializeBends( int nBends, Bend** bendArr
1275      if( the_bends[i].isGhost ) atomC = "GHOST";
1276      else atomC = the_atoms[c]->getType();
1277  
1278 <    currentBendType = headBendType->find( atomA, atomB, atomC );
1278 >    currentBendType = headBendType->find( atomA.c_str(), atomB.c_str(), atomC.c_str());
1279      if( currentBendType == NULL ){
1280        sprintf( painCave.errMsg, "BendType error, %s - %s - %s not found"
1281                 " in force file.\n",
1282 <               atomA, atomB, atomC );
1282 >               atomA.c_str(), atomB.c_str(), atomC.c_str() );
1283        painCave.isFatal = 1;
1284        simError();
1285      }
# Line 1306 | Line 1302 | void DUFF::initializeBends( int nBends, Bend** bendArr
1302                     "  --> central atom is not "
1303                     "correctly identified with the "
1304                     "\"ghostVectorSource = \" tag.\n",
1305 <                   atomA, atomB, atomC );
1305 >                   atomA.c_str(), atomB.c_str(), atomC.c_str() );
1306            painCave.isFatal = 1;
1307            simError();
1308          }
# Line 1338 | Line 1334 | void DUFF::initializeTorsions( int nTorsions, Torsion*
1334                                        torsion_set* the_torsions ){
1335  
1336    int i, a, b, c, d;
1341  char* atomA;
1342  char* atomB;
1343  char* atomC;
1344  char* atomD;
1337  
1338    CubicTorsion* cTors;
1339    Atom** the_atoms;
# Line 1356 | Line 1348 | void DUFF::initializeTorsions( int nTorsions, Torsion*
1348      c = the_torsions[i].c;
1349      d = the_torsions[i].d;
1350  
1351 <    atomA = the_atoms[a]->getType();
1352 <    atomB = the_atoms[b]->getType();
1353 <    atomC = the_atoms[c]->getType();
1354 <    atomD = the_atoms[d]->getType();
1363 <    currentTorsionType = headTorsionType->find( atomA, atomB, atomC, atomD );
1351 >    currentTorsionType = headTorsionType->find( the_atoms[a]->getType().c_str(),
1352 >                                                                                  the_atoms[b]->getType().c_str(),
1353 >                                                                                   the_atoms[c]->getType().c_str(),
1354 >                                                                                  the_atoms[d]->getType().c_str() );
1355      if( currentTorsionType == NULL ){
1356        sprintf( painCave.errMsg,
1357                 "TorsionType error, %s - %s - %s - %s not found"
1358                 " in force file.\n",
1359 <               atomA, atomB, atomC, atomD );
1359 >                the_atoms[a]->getType().c_str(),
1360 >                the_atoms[b]->getType().c_str(),
1361 >                the_atoms[c]->getType().c_str(),
1362 >                the_atoms[d]->getType().c_str() );
1363        painCave.isFatal = 1;
1364        simError();
1365      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines