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++ ) { |
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 { |
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 { |
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 |
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"; |
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 |
|
|