I am a non-chemist using RDKit to determine the number of "nonring, nonterminal atoms" in a molecule.

I can't find anything in the RDKit documentation that helps with "nonterminal". Can it be used for that?

I can using RDKit's AtomRings function to identify atoms in rings, but perhaps there is a more direct way?

  • 4
    $\begingroup$ Welcome! I'm not 100% sure I know what you mean by "non-terminal" but I guess you mean that an atom has more than one bond. I'd suggest using SMARTS - seems like you want something like [*R0!D1]. It's often helpful to use SMARTSview to test these patterns. $\endgroup$ – Geoff Hutchison Dec 24 '20 at 3:14

I think you want to use SMARTS patterns to perform searches. These are something like "regular expression" patterns for molecular graphs.

At a rough guess, your query converts to [*R0!D1]:

  • * matches any atom (i.e., you don't care if it's a carbon or an oxygen)
  • R0 matches an atom in a ring with size 0 (i.e., not a ring atom)
  • D1 matches an atom with explicitly one bond (so !D1 matches atoms with more than one bond).

It's often helpful to use SMARTSview to test patterns.

More on RDKit's SMARTS support can be found in the documentation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.