When a molecular scene contains many structural groups, finding the one you need by visual inspection can become a slow, repetitive task. You may be looking for a large group, checking which groups contain nitrogen or sulfur, or narrowing a model by charge. In SAMSON, the Node Specification Language (NSL) lets you describe these properties as queries instead of checking each group manually.
This guide focuses on a practical first pass: use structural-group attributes to sort through groups by size, elemental composition, charge, or structure ID. The attribute space is structuralGroup, abbreviated sg, and its queries match structural group nodes.
Start with size
If your immediate problem is finding groups that are unusually large or small, query their atom counts. For example, sg.nat > 100 matches groups with more than 100 atoms. To look for groups within a range, use sg.nat 100:200. The full attribute name is structuralGroup.numberOfAtoms; the shorter form is easier to type once you recognize it.
Atom count is a useful first filter when a model contains groups of very different sizes. It can help you focus on substantial components rather than scanning every group in the scene. The same comparison and range style is available for several element counts.
Check composition without counting by eye
Element-specific counts can help answer questions such as “Which groups contain many oxygens?” or “Are there groups with only a few carbons?” Use sg.nO for the number of oxygen atoms, sg.nC for carbon, sg.nN for nitrogen, sg.nH for hydrogen, and sg.nS for sulfur.
sg.nC < 10looks for groups with fewer than 10 carbon atoms.sg.nN 10:20looks for groups with between 10 and 20 nitrogen atoms.sg.nS 10:20applies the same kind of range to sulfur atoms.
For coarse-grained models, sg.ncga queries the number of coarse-grained atoms, while sg.nat refers to the number of atoms. Keeping those two counts distinct is useful when comparing groups represented at different levels of detail.
Use charge to narrow the search
When charge is the property that matters, structural groups provide both formal and partial charge attributes. sg.fc refers to total formal charge and takes integer values. For example, sg.fc 1 matches groups with formal charge equal to 1, while sg.fc 6:8 selects a range of formal charges.
sg.pc refers to total partial charge and accepts real values. For instance, sg.pc 1.5:2.0 matches groups with partial charge between 1.5 and 2.0. These are different properties, so choose the one that corresponds to the charge information you want to inspect.
Find groups by structure ID
If you already know a structure ID, sg.id can locate matching groups. You can compare IDs, as in sg.id >= 10, or specify multiple ranges, as in sg.id 5:10, 25:30. This is especially handy when you have an ID or set of IDs from another step in your workflow and want to return to those groups quickly.
A small query toolkit
One practical approach is to begin with the attribute that most directly describes your target: size, a particular element count, charge, or ID. Try a broad range first, then adjust the values to make the results more specific. The examples here are individual NSL expressions; they show the available attribute names and value formats without assuming a particular way to combine filters.
Structural groups also inherit node attributes, including name, visible, hidden, and selected. For example, sg.n "A" uses a name match, and sg.v refers to visibility. These can be useful when the task is about identifying or checking the state of a group rather than its chemical composition.
Once you know the short names, NSL queries become a compact way to express what you are looking for—and easier to revise than a long manual search. For the complete attribute reference and additional details, see the structural group attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
