ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/ForceField.cpp
(Generate patch)

Comparing trunk/src/UseTheForce/ForceField.cpp (file contents):
Revision 1276 by cli2, Fri Jul 4 20:54:29 2008 UTC vs.
Revision 1277 by gezelter, Mon Jul 14 12:35:58 2008 UTC

# Line 124 | Line 124 | namespace oopse {
124            myKeys.push_back((*i)->getName());
125            myKeys.push_back((*j)->getName());
126  
127 +          std::cerr << "looking for " << myKeys[0] << " " << myKeys[1] << "\n";
128            BondType* bondType = bondTypeCont_.find(myKeys);
129            if (bondType) {
130              foundBonds.push_back(std::make_pair(bondTypeScore, myKeys));
# Line 133 | Line 134 | namespace oopse {
134          ii++;
135        }
136  
136      // sort the foundBonds by the score:
137  
138 <      std::sort(foundBonds.begin(), foundBonds.end());
139 <      
140 <      int bestScore = foundBonds[0].first;
141 <      std::vector<std::string> theKeys = foundBonds[0].second;
142 <
143 <      std::cout << "best matching bond = " << theKeys[0] << "\t" << theKeys[1]  << "\t(score = "<< bestScore << ")\n";      
144 <      BondType* bestType = bondTypeCont_.find(theKeys);
145 <      if (bestType)
146 <        return bestType;
147 <      else {
148 <        //if no exact match found, try wild card match
149 <        return bondTypeCont_.find(keys, wildCardAtomTypeName_);      
138 >      if (foundBonds.size() > 0) {
139 >        // sort the foundBonds by the score:
140 >        std::sort(foundBonds.begin(), foundBonds.end());
141 >    
142 >        int bestScore = foundBonds[0].first;
143 >        std::vector<std::string> theKeys = foundBonds[0].second;
144 >        
145 >        std::cout << "best matching bond = " << theKeys[0] << "\t" << theKeys[1]  << "\t(score = "<< bestScore << ")\n";      
146 >        BondType* bestType = bondTypeCont_.find(theKeys);
147 >        
148 >        return bestType;
149 >      } else {
150 >        //if no exact match found, try wild card match
151 >        return bondTypeCont_.find(keys, wildCardAtomTypeName_);      
152        }
153      }
154    }
# Line 220 | Line 222 | namespace oopse {
222          jj++;
223        }
224        
225 <      std::sort(foundBends.begin(), foundBends.end());
226 <
227 <      int jscore = foundBends[0].first;
228 <      int ikscore = foundBends[0].second;
229 <      std::vector<std::string> theKeys = foundBends[0].third;
230 <
231 <      std::cout << "best matching bend = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t(scores = "<< jscore << "\t" << ikscore << ")\n";      
232 <
233 <      BendType* bestType = bendTypeCont_.find(theKeys);  
234 <      if (bestType)
235 <        return bestType;
234 <      else {
235 <      
225 >      if (foundBends.size() > 0) {
226 >        std::sort(foundBends.begin(), foundBends.end());
227 >        int jscore = foundBends[0].first;
228 >        int ikscore = foundBends[0].second;
229 >        std::vector<std::string> theKeys = foundBends[0].third;
230 >        
231 >        std::cout << "best matching bend = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t(scores = "<< jscore << "\t" << ikscore << ")\n";      
232 >        
233 >        BendType* bestType = bendTypeCont_.find(theKeys);  
234 >        return bestType;
235 >      } else {        
236          //if no exact match found, try wild card match
237          return bendTypeCont_.find(keys, wildCardAtomTypeName_);      
238        }
239      }
240    }
241  
242
242    TorsionType* ForceField::getTorsionType(const std::string &at1,
243                                            const std::string &at2,
244                                            const std::string &at3,
# Line 327 | Line 326 | namespace oopse {
326          jj++;
327        }
328        
329 <      std::sort(foundTorsions.begin(), foundTorsions.end());
330 <
331 <      int jkscore = foundTorsions[0].first;
332 <      int ilscore = foundTorsions[0].second;
333 <      std::vector<std::string> theKeys = foundTorsions[0].third;
334 <
335 <      std::cout << "best matching torsion = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t" << theKeys[3] << "\t(scores = "<< jkscore << "\t" << ilscore << ")\n";
336 <
337 <      
338 <      TorsionType* bestType = torsionTypeCont_.find(theKeys);
340 <      if (bestType) {
341 <        return bestType;
329 >      if (foundTorsions.size() > 0) {
330 >        std::sort(foundTorsions.begin(), foundTorsions.end());
331 >        int jkscore = foundTorsions[0].first;
332 >        int ilscore = foundTorsions[0].second;
333 >        std::vector<std::string> theKeys = foundTorsions[0].third;
334 >        
335 >        std::cout << "best matching torsion = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t" << theKeys[3] << "\t(scores = "<< jkscore << "\t" << ilscore << ")\n";
336 >                
337 >        TorsionType* bestType = torsionTypeCont_.find(theKeys);
338 >        return bestType;
339        } else {
340          //if no exact match found, try wild card match
341          return torsionTypeCont_.find(keys, wildCardAtomTypeName_);
# Line 431 | Line 428 | namespace oopse {
428          }
429          jj++;
430        }
431 <      
432 <      std::sort(foundInversions.begin(), foundInversions.end());
433 <      
434 <      int iscore = foundInversions[0].first;
435 <      int jklscore = foundInversions[0].second;
436 <      std::vector<std::string> theKeys = foundInversions[0].third;
437 <      
438 <      std::cout << "best matching inversion = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t" << theKeys[3] << "\t(scores = "<< iscore << "\t" << jklscore << ")\n";
439 <      
440 <      
441 <      InversionType* bestType = inversionTypeCont_.find(theKeys);
445 <      if (bestType) {
446 <        return bestType;
431 >        
432 >      if (foundInversions.size() > 0) {
433 >        std::sort(foundInversions.begin(), foundInversions.end());
434 >        int iscore = foundInversions[0].first;
435 >        int jklscore = foundInversions[0].second;
436 >        std::vector<std::string> theKeys = foundInversions[0].third;
437 >        
438 >        std::cout << "best matching inversion = " << theKeys[0] << "\t" <<theKeys[1]  << "\t" << theKeys[2] << "\t" << theKeys[3] << "\t(scores = "<< iscore << "\t" << jklscore << ")\n";
439 >                
440 >        InversionType* bestType = inversionTypeCont_.find(theKeys);
441 >        return bestType;
442        } else {
443          //if no exact match found, try wild card match
444          return inversionTypeCont_.find(keys, wildCardAtomTypeName_);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines