On Feb 21, 2023, at 19:23, Thomas <odioidenti...@gmail.com> wrote: > Is it possible to get SMILES with explicit hydrogens as a "property" of > another atom? > For example from the SMILES "CC" I'd like to get '[CH3][CH3]' instead of > '[H]C(C([H])([H])[H])([H])[H]'
I don't see a direct way to do it. I wrote to_H_smiles() at https://paste.sr.ht/~dalke/8f51a0df8b37585010ca38b54a337f4efbec8667 which I think does what you want. In short, I add an atom class to each atom, generate the SMILES with the 'a' option to include the atom class. As a side-effect, this also include the H3 terms you're looking for. I then post-process the output SMILES to adjust the atom classes, either to remove them (if the original atom didn't have an atom class) or to use the original input value. > Furthermore, is it possible to generate SMARTS? For example from "CC" I'd > like to get '[#6]-[#6]' I don't know of one, though that doesn't mean there isn't one. Andrew da...@dalkescientific.com _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss