Thank you, Wim. It works. Even a simpler solution can be to remove all
atoms except required ones. I had to guess :)
However, this is a bug in the recent RDKit versions. The function
MolFragmentToSmiles works correctly in version 2023, but not in 2024.
On 28/03/2025 00:10, Wim Dehaen wrote:
Pa
Pavel,
this is a bit hacky, but you can try the below:
```
def get_frag_smi(mol,frag_atoms):
if len(frag_atoms) > 1:
b2b = [] # bonds to break
fsmi = "" #fragment smiles
# get bonds outside of fragment
for b in mol.GetBonds():
b_idx = b.GetBeginAtomId
2 matches
Mail list logo