When a molecular structure contains several rings, selecting the right atoms by eye can be tedious—and easy to get wrong. You may want just the aromatic carbons, atoms in five- or six-membered rings, or ring atoms that also meet a chemical criterion. SAMSON’s Node Specification Language (NSL) lets you express these conditions as readable atom queries.
In the examples below, a is the short name for the atom attribute space. Atom attributes match atom nodes, and you can combine conditions with and. The result is a more precise selection than using any one property alone.
Start with the question, not the query
Before writing an expression, decide what “ring atoms” means for your task. It might mean every atom that is part of a ring, only atoms in a particular ring size, or a chemically defined subset such as aromatic carbon atoms. Those are different filters, and choosing the right one helps prevent an overly broad selection.
To find atoms that are in rings, use:
|
1 |
a.inRing |
This is a useful first check when you want to identify ring membership without restricting the result by element or ring size.
Add chemical criteria
For aromatic carbon atoms that are in rings, combine the symbol, aromaticity, and ring-membership attributes:
|
1 |
a.s C and a.ar and a.inRing |
Each part answers a separate question: a.s C selects carbon atoms, a.ar selects aromatic atoms, and a.inRing limits the result to atoms in rings. Using explicit conditions makes it easier to review what your query is intended to select—and to adjust it later.
If you want atoms in five- or six-membered rings, use the ring-size attribute:
|
1 |
a.ringSize 5,6 |
You can combine it with the aromatic-carbon filter when that is the actual target:
|
1 |
a.s C and a.ar and a.ringSize 5,6 |
The comma-separated values mean “5 or 6.” The documentation notes an important detail: when an atom belongs to rings of different sizes, ringSize returns the smallest ring size. So this attribute is not a complete list of every ring an atom belongs to. Keep that behavior in mind when interpreting results in fused or otherwise multi-ring structures.
Use a small-to-specific workflow
-
Check ring membership. Begin with
a.inRingto identify the broad set of ring atoms. -
Choose the structural criterion. Add
a.ringSize 5,6if ring size matters, ora.arif aromaticity matters. -
Restrict by element if needed. Add
a.s Cfor carbon, or use another element symbol such asa.s Nora.s O. -
Read the expression back in plain language. For example,
a.s C and a.ar and a.inRingmeans “carbon atoms that are aromatic and in rings.” If that sentence does not describe the atoms you need, revise the query before relying on the selection.
This approach is useful whenever a selection needs to be both chemically meaningful and reproducible. Instead of remembering which atoms you clicked, you can keep the criteria together in a compact expression. It also makes troubleshooting easier: temporarily remove one condition at a time to see whether element, aromaticity, ring membership, or ring size is narrowing the result too far.
For the complete attribute reference and additional examples, see the SAMSON atom attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
