Count an Element in a Molecule (Number of Atoms)
This workflow counts the number of atoms in a molecule for an element of choice. This is done by first getting the chemical symbol. The RDKit Substructure Counter then counts the occurrences of the element. The Motif of a RDKit From Molecule and an RDKit To Molecule is to convert potentially aromatic elements into their ambivalent SMARTS representation. For example: [C] is an aliphatic carbon, [c] is an aromatic carbon, and [#6] can match both. Therefore the representation [#6] is needed to count elements irrespective of aromaticity.
If you only want to count, C, O, N, you can use the Speedy SMILES Element Count (C, N, O) node by Vernalis instead.