if old_roots:
current_root = old_roots.pop()
else: // go to next disconnected fragment
next_frag = (frag for frag_num, frag in enumerate(frags)
if frag_num not in visited_frags)[0]
current_root = frags[next_frag]
visited_frags.append(next_frag)
// close opened branches if any is open
After Change
// if flexible molecule contains multiple fragments write them separately
if flexible and len(Chem.GetMolFrags(mol)) > 1:
return "".join(MolToPDBQTBlock(frag, flexible=flexible, addHs=addHs,
computeCharges=computeCharges)
for frag in Chem.GetMolFrags(mol, asMols=True))
// Identify donors and acceptors for atom typing
// Acceptors