pckroon / pysmiles

A lightweight python-only library for reading and writing SMILES strings
Apache License 2.0
147 stars 21 forks source link

fill valance fails for charged molecules #40

Closed fgrunewald closed 5 months ago

fgrunewald commented 6 months ago

This little example should work in my opinion but does not:

import pysmiles
g=pysmiles.read_smiles("CCC[O-]")
pysmiles.smiles_helper.fill_valence(g, respect_hcount=False)
assert g.nodes[3]['hcount'] == 0

Origin of the problem is that fill_valence does not account for charges.