2
$\begingroup$

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?

cyclohexanol labeled

$\endgroup$
1
  • 2
    $\begingroup$ 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. $\endgroup$ Jan 8 at 22:52
6
$\begingroup$

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

enter image description here

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

enter image description here

$\endgroup$
3
  • 2
    $\begingroup$ I presume you mean cyclohexanol, not cyclohexanone. $\endgroup$
    – z1273
    Jan 9 at 17:42
  • $\begingroup$ @z1273 Changed -one to -ol. Thank you. $\endgroup$
    – rapelpy
    Jan 9 at 18:24
  • $\begingroup$ Thank you very much for the detailed answer! $\endgroup$
    – Gesetzt
    Jan 10 at 17:09

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.