Because the H atoms are by default not explicitly present in the molecular
graph, the substructure matcher cannot match to them.
If you have queries that include explicit Hs like this and you really want
to match to them, you will need to call AddHs() on the molecules before
doing the substructure match. This will slow everything down a lot.

Depending upon what you want to do, an alternative may be to edit your
query to something like:
In [37]: smarts = 'c1c[cH,$(c[F,Cl,I])]ccc1'

In [39]:
Chem.MolFromSmiles('c1ccccc1').HasSubstructMatch(Chem.MolFromSmarts(smarts))
Out[39]: True

In [40]:
Chem.MolFromSmiles('Cc1c(C)c(C)c(C)c(C)c1C').HasSubstructMatch(Chem.MolFromSmarts(smarts))
Out[40]: False

-greg


On Thu, Jan 19, 2017 at 6:49 PM, Changge Ji <chicago...@gmail.com> wrote:

> Dear All,
>
>  I'm a new to rdkit.
>
> I fount that the molecule 'c1ccccc1' don't fit to the smarts
> 'c1cc([#1,F,Cl,I])ccc1'
>
> -------------------------------------------------------
> mol =  Chem.MolFromSmiles('c1ccccc1')
> fap = FragmentMatcher.FragmentMatcher()
> smarts = 'c1cc([#1,F,Cl,I])ccc1'
> fap.Init(smarts)
> tp = fap.HasMatch(mol)
>
> result : tp = 0
> -----------------------------------------------------
>
> It seems that it is due to the explict H atom in smarts.
>
> How can I make my smarts work?
>
> Thank you for your help.
>
>
>
>
> Best,
>
>
> ------------------------------
> Changge
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to