Skip to content

Infinite loop in SDGenerator #540

@dstoeckel

Description

@dstoeckel

When trying to reproduce bug #536 I used BALLViews "Build from SMILES" functionality to generate the suggested example molecule:

COc1=c2c(=cc=c1)OCCCCCCCCOc1=c(c3=c4c(=c2c2=cc=cc=c32)c=cc=c4)c(=cc=c1)O

However, processing of this SMILE never terminates. Processing seems to hang in BALL::RingAnalyser::sequenceRing:

while(!ring_atoms.empty())
{
    for (std::list<Atom*>::iterator ring_it  = ring_atoms.begin();
                                    ring_it != ring_atoms.end(); ++ring_it)
    {
        if (last_atom->isBoundTo(**ring_it))
        {
            ring[++last_index] = *ring_it;
            last_atom = *ring_it;
            ring_atoms.erase(ring_it);
            break;
        }
    }
}

Termination if no ring atom could be erased:

while(!ring_atoms.empty())
{
    bool found = false;
    for (std::list<Atom*>::iterator ring_it  = ring_atoms.begin();
                                    ring_it != ring_atoms.end(); ++ring_it)
    {
        if (last_atom->isBoundTo(**ring_it))
        {
            ring[++last_index] = *ring_it;
            last_atom = *ring_it;
            ring_atoms.erase(ring_it);
            found = true;
            break;
        }
    }
    if(!found) break;
}

lead to a subsequent segmentation fault in BALL::RingAnalyser::peelNextRing_.

Edit: fix bogus termination condition

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions