# SMART string for alkyl group excluding alcohols

I'm quite new to the usage of SMARTS strings. I would like to find all alkyl groups (but no $$\ce{CH3})$$ in a component, here e.g. cyclohexanol (C1CCC(CC1)O).

My SMARTS string is: [CX4;H0,H1,H2]

However, this matches every carbon. I would like to write my smart string, so that C:3 is not matched, because it is bound to something else than a carbon (here: oxygen). How is this possible with SMARTS?

• I think the question is on topic here, but I guess it would get better attention and answers at Matter Modeling. I suggest migrating it. Jan 8 at 22:52

How to find carbon

• with four connections
• not -CH3
• and only connected to carbon

As in your SMILES there are only implicit hydrogen, you do not need to count Hs. Count the explicit bonds and exclude the carbon with one explicit bond to avoid -CH3.

[CX4;D2,D3,D4]

To find the carbons that are connected to others than carbon

C[!C]

Now you can use recursive SMARTS, and set the second pattern to NOT.

[CX4;D2,D3,D4;!$(C[!C])] Now only carbons would be found that match both patterns. CX4 C with total connections of 4 D<n> number of explicit bonds $() recursive SMARTS

! NOT

; AND

, OR

In cyclohexanol it will find

and here is a dummy molecule for testing it. CCC(F)C=CCC1CCC(O)C(C(C)(C)C)C1

• I presume you mean cyclohexanol, not cyclohexanone. Jan 9 at 17:42
• @z1273 Changed -one to -ol. Thank you. Jan 9 at 18:24
• Thank you very much for the detailed answer! Jan 10 at 17:09