mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-06 22:39:55 +08:00
basic smiles memory consumption
This commit is contained in:
@@ -153,6 +153,7 @@ namespace RDKit{
|
||||
if(res->hasAtomBookmark(ci_RIGHTMOST_ATOM)){
|
||||
res->clearAtomBookmark(ci_RIGHTMOST_ATOM);
|
||||
}
|
||||
SmilesParseOps::CleanupAfterParsing(res);
|
||||
molVect[0]=0; // NOTE: to avoid leaks on failures, this should occur last in this if.
|
||||
}
|
||||
} catch (SmilesParseException &e) {
|
||||
|
||||
@@ -475,4 +475,21 @@ namespace SmilesParseOps{
|
||||
}
|
||||
};
|
||||
|
||||
void CleanupAfterParsing(RWMol *mol){
|
||||
PRECONDITION(mol,"no molecule");
|
||||
for(RWMol::AtomIterator atomIt=mol->beginAtoms();
|
||||
atomIt!=mol->endAtoms();++atomIt){
|
||||
if((*atomIt)->hasProp("_RingClosures"))
|
||||
(*atomIt)->clearProp("_RingClosures");
|
||||
if((*atomIt)->hasProp("_SmilesStart"))
|
||||
(*atomIt)->clearProp("_SmilesStart");
|
||||
}
|
||||
for(RWMol::BondIterator bondIt=mol->beginBonds();
|
||||
bondIt!=mol->endBonds();++bondIt){
|
||||
if((*bondIt)->hasProp("_unspecifiedOrder"))
|
||||
(*bondIt)->clearProp("_unspecifiedOrder");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace SmilesParseOps
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace SmilesParseOps {
|
||||
const RDKit::Atom *atom2);
|
||||
void CloseMolRings(RDKit::RWMol *mol,bool toleratePartials);
|
||||
void AdjustAtomChiralityFlags(RDKit::RWMol *mol);
|
||||
void CleanupAfterParsing(RDKit::RWMol *mol);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user