When a molecular scene contains many node groups, the small task of finding one particular group can interrupt a larger modeling workflow. A group may have a memorable name, or it may already be selected; either way, guessing at the query syntax is an avoidable source of friction. SAMSON’s Node Specification Language (NSL) provides a compact way to match node groups by their attributes.
The key starting point is the nodeGroup attribute space, whose short name is ng. It matches node group nodes. That scope matters: using ng makes your intention explicit, rather than relying on a query that might be read as applying to another kind of node.
Find groups by name
For a group with an exact name, use the name attribute and put the string in quotes. For example, ng.n "A" matches a node group named “A”. The shorter form n is available for name, so you can use either the full attribute name or its short name.
The reference also gives ng.n "L*" as an example. This is useful when you want to search using a name pattern rather than type out a complete group name. If a result is unexpected, check the spelling and quotation marks first, then confirm that the expression begins with ng so it targets node groups.
Check selection state separately
Node groups inherit the selected attribute from the node attribute space. You can query for selected groups with ng.selected, or for groups that are not selected with not ng.selected. This can help when you need to distinguish a group that is currently selected from one that is not.
There is also a selectionFlag attribute, abbreviated sf. The documented examples are ng.sf and ng.sf false. These are separate attribute names in the reference, so do not substitute one for the other just because both contain the word “selection.” When building a query, choose the attribute that matches the state you actually intend to inspect.
A quick query checklist
- Looking for a named group? Try
ng.name "A"or its shorter form,ng.n "A". - Looking for a name pattern? The reference shows
ng.n "L*"as an example. - Looking for selected groups? Use
ng.selected. - Looking for groups that are not selected? Use
not ng.selected. - Checking the selection flag? Use the distinct
selectionFlagattribute, or its short namesf, as inng.sf false.
These expressions are small, but using the right attribute space and keeping the two selection-related attributes distinct can make group searches easier to read and repeat. For the full attribute reference, see the SAMSON node group attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at www.samson-connect.net.
