Post #1978206
2026-04-14 07:12 UTC
@molecule Nice. 6! = 720 hence only 2 matches with a default max of 1,000.
Looks like "d" is an RDKit extension for non-hydrogen degree. I didn't know about it.
I've been toying with a new SMARTS extension:
'#' ('-' | '=' | '#' | ':') = for n single (implicit and explicit), double, triple, or aromatic bonds
Your pattern might then be written "[d6#-6]", since I don't think you need to match aromatic bonds.
"Atom with at least one a double or triple bond" would be "[!#=0;!##0]".
Replies (1)
-
@dalke@toots.nu 2026-04-15 14:29
@molecule .... and here's a diff which adds that to RDKit. (Incomplete. Doesn't do the full function registration or handle MolToSmarts or have tests.) https://paste.sr.ht/~dalke/e3748ccea2bf3b58c04abd8fa9aaebb57953ce13 With it, something like [!$(*#*)&!D1] can be replaced with [##0!D1], and make HasSubstructMatch twice as fast. BTW, my has-a-double-or-triple-bond SMARTS should be "[!#=0,!##0]" (with "," not ";"). :) To go further than this POC and add it to RDKit would require evidence of of utility that I can't provide.