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

Comparing trunk/src/openbabel/kekulize.cpp (file contents):
Revision 741 by tim, Wed Nov 16 19:42:11 2005 UTC vs.
Revision 1081 by gezelter, Thu Oct 19 20:49:05 2006 UTC

# Line 59 | Line 59 | void OBMol::NewPerceiveKekuleBonds()
59    OBBond *bond;
60    std::vector<OBEdgeBase*>::iterator bi;
61    std::vector<int> electron;
62 <  int BO;
63 <  int sume, orden, bestorden, bestatom;
62 >  int sume, orden, bestatom;
63 >  int bestorden = 99;
64    // Init the kekulized bonds
65    unsigned i;
66 <        for(i=0; i< NumBonds(); i++ ) {
67 <    bond = GetBond(i);
68 <    BO = bond->GetBO();
69 <    switch (BO)
66 >  FOR_BONDS_OF_MOL(bond, *this)
67      {
68 <    case 1: bond->SetKSingle(); break;
69 <    case 2: bond->SetKDouble(); break;
70 <    case 3: bond->SetKTriple(); break;
68 >      switch (bond->GetBO())
69 >        {
70 >        case 1: bond->SetKSingle(); break;
71 >        case 2: bond->SetKDouble(); break;
72 >        case 3: bond->SetKTriple(); break;
73 >        }
74      }
75  }
75  
76    // Find all the groups of aromatic cycle
77    for(i=1; i<= NumAtoms(); i++ ) {
# Line 162 | Line 161 | void OBMol::NewPerceiveKekuleBonds()
161          }
162          if (bestorden==99) {  // no electron giving atom found
163            errorMsg << "Kekulize: Huckel rule not satisfied for molecule " << GetTitle() << endl;
164 <          obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obInfo);
164 >          obErrorLog.ThrowError(__func__, errorMsg.str(), obInfo);
165            break;             // Huckel rule cannot be satisfied
166          }                    // try to kekulize anyway
167          else {
# Line 189 | Line 188 | void OBMol::NewPerceiveKekuleBonds()
188            }
189            if (bestorden==99) {  // no electron giving atom found
190              errorMsg << "Kekulize: Cannot get an even number of electron for molecule " << GetTitle() << "\n";
191 <          obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obInfo);
191 >          obErrorLog.ThrowError(__func__, errorMsg.str(), obInfo);
192              break;             // impossible to choose an atom to obtain an even number of electron
193            }                    // try to kekulize anyway
194            else {
# Line 338 | Line 337 | void OBMol::start_kekulize( std::vector <OBAtom*> &cyc
337      strstream errorMsg;
338   #endif
339      errorMsg << "Kekulize Error for molecule " << GetTitle() << endl;
340 <    obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obInfo);
340 >    obErrorLog.ThrowError(__func__, errorMsg.str(), obInfo);
341      }
342  
343    // Set the double bonds
# Line 347 | Line 346 | void OBMol::start_kekulize( std::vector <OBAtom*> &cyc
346      bond = GetBond(i);    
347      // std::cout << "bond " << bond->GetBeginAtomIdx() << " " << bond->GetEndAtomIdx() << " ";
348      if (bond->GetBO()==5 && bcurrentState[i] == DOUBLE) {
349 +      if ( (bond->GetBeginAtom())->IsSulfur()
350 +           && bond->GetEndAtom()->IsSulfur() ) {
351 +        // no double bonds between aromatic sulfur atoms -- PR#1504089
352 +        continue;
353 +      }
354 +
355        bond->SetKDouble();
356        bond->SetBO(2);
357        //std::cout << "double\n";
# Line 418 | Line 423 | int OBMol::expand_kekulize(OBAtom *atom1, OBAtom *atom
423  
424      errorMsg << "unexpected state:" << "atom " << Idx1 << " " << currentState[Idx1]
425           << " atom " << Idx2 << " " << currentState[Idx2] << endl;
426 <    obErrorLog.ThrowError(__FUNCTION__, errorMsg.str(), obDebug);
426 >    obErrorLog.ThrowError(__func__, errorMsg.str(), obDebug);
427      return(false);
428    }
429  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines