A large molecular model can be difficult to inspect one group at a time. Maybe you need to find a fragment with an unexpectedly high atom count, locate groups containing a particular number of oxygen atoms, or check which groups carry a certain total charge. The challenge is turning those questions into precise, repeatable searches rather than relying on visual inspection.
SAMSON’s Node Specification Language (NSL) provides attributes for matching structural groups by their size, elemental composition, charge, and structure ID. The structural-group attribute space is written structuralGroup, or more compactly sg. The examples below show how to express common inspection questions as queries.
Start with the size of a group
When a structure contains many groups, atom count is a useful first way to narrow the search. Use numberOfAtoms, abbreviated nat:
sg.nat > 100matches structural groups with more than 100 atoms.sg.nat 100:200matches groups with between 100 and 200 atoms.
This makes it possible to focus on groups in a chosen size range rather than manually checking every group. The range form is also available for several other numeric attributes.
Check composition without counting by eye
To focus on a specific element, use its count attribute. For example, sg.nO < 10 matches groups with fewer than 10 oxygen atoms, while sg.nC 10:20 matches groups with between 10 and 20 carbon atoms.
The documented element-count abbreviations are nC for carbon, nH for hydrogen, nN for nitrogen, nO for oxygen, and nS for sulfur. For coarse-grained models, sg.ncga < 1000 can be used to match groups with fewer than 1,000 coarse-grained atoms. These attributes help answer focused questions about composition without inferring it from a group’s appearance.
Use charge queries to find groups of interest
Structural groups can also be matched by total formal charge or total partial charge. For formal charge, sg.fc 6:8 matches groups with formal charge between 6 and 8. For partial charge, sg.pc 1.5:2.0 matches groups with total partial charge in that interval.
These attributes describe different kinds of charge, so choose the one that corresponds to the question you are asking. Formal charge takes integer values; partial charge can take real values. For example, use sg.fc 1 to find groups with formal charge equal to 1, or sg.pc 1 to find groups with partial charge equal to 1.
Keep track of structure IDs and visibility
If you already know which structure IDs you want to inspect, sg.id can match them by value or range. For example, sg.id >= 10 matches groups with structure IDs greater than or equal to 10, and sg.id 5:10, 25:30 matches IDs in either of the two listed ranges.
Structural groups also inherit useful node attributes. For example, sg.v matches visible groups, while not sg.v matches groups that are not visible. You can use sg.h for the hidden attribute, and sg.n "L*" to match by a quoted name expression. The full set of inherited attributes includes material, selection, name, and visibility properties.
Make the query fit the question
A practical way to choose an attribute is to state the inspection task in plain language first: “groups with more than 100 atoms,” “groups with 10–20 carbons,” or “groups with partial charge between 1.5 and 2.0.” Then map the measured property to its NSL attribute: nat, nC, or pc. The short names keep expressions compact, while the full names—such as structuralGroup.numberOfAtoms—make their meaning explicit.
These queries are useful when visual inspection alone is slow or ambiguous: they make the selection criterion visible and easy to revisit. To explore every structural-group attribute and its examples, see the structural group attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
