Skip to content

[Q&A] How to identify which molecule is organic? #5314

Answered by greglandrum
IchiruTake asked this question in General
Discussion options

You must be logged in to vote

@IchiruTake I think the hardest part of this is defining what you mean by "organic", the rest is probably a relatively straightforward function.

Here's a simple definition which illustrates an approach to solve this once you figure out a definition you're happy with:

simpleOrganicAtomQuery = Chem.MolFromSmarts('[!$([#1,#5,#6,#7,#8,#9,#15,#16,#17,#35,#53])]')
simpleOrganicBondQuery = Chem.MolFromSmarts('[#6]-,=,#,:[#6]')
hasCHQuery = Chem.MolFromSmarts('[C!H0]')
def simple_is_organic(mol):
     return (not mol.HasSubstructMatch(simpleOrganicAtomQuery)) and mol.HasSubstructMatch(hasCHQuery) and mol.HasSubstructMatch(simpleOrganicBondQuery)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@IchiruTake
Comment options

@greglandrum
Comment options

@IchiruTake
Comment options

@IchiruTake
Comment options

Answer selected by IchiruTake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants