When a molecular scene contains many node groups, finding the one you want can become a small but persistent distraction. You may know its name, or you may need to distinguish groups by their selection state. SAMSON’s Node Specification Language (NSL) lets you express those criteria directly for node group nodes.
This guide focuses on three useful attributes: name, selected, and selectionFlag. The key is to be precise about what each expression says—and not to mix up the two selection-related attributes.
Start by identifying the node type
The node group attribute space is written nodeGroup, with the short name ng. Its expressions match node group nodes. That makes ng a useful starting point when your goal is specifically to inspect or find groups rather than other kinds of nodes.
Find groups by name
Use ng.n as the short form of the name attribute. Names are written as strings in quotes. For example:
ng.n "A"specifies a group by the nameA.ng.n "L*"is another documented name expression.
If a name-based expression does not give you the result you expect, check the spelling and quotation marks first. The documentation lists these expressions as examples; consult the NSL reference for details about name matching and expression behavior.
Use selection attributes carefully
Two inherited attributes relate to selection, but they have different names and short-name rules:
selectedacceptstrueorfalse. For node groups, it does not have the short names. The documented examples areng.selectedandnot ng.selected.selectionFlaghas the short namesfand also acceptstrueorfalse. The examples includeng.sfandng.sf false.
This distinction is useful when reading or writing expressions: ng.selected refers to selected, while ng.sf refers to selectionFlag. The fact that both are selection-related does not make them interchangeable. If you are unsure which one a task requires, use the full attribute name while drafting your expression, then check the attribute reference before relying on a short form.
A simple way to build a query
Think of the task in two steps. First, decide that the target should be a node group by using the ng attribute space. Then choose the attribute that describes the property you care about: ng.n for a name, ng.selected for the selected attribute, or ng.sf for the selection flag. Keeping those choices separate makes expressions easier to read and easier to troubleshoot.
For example, if you are checking a group called “A,” start with ng.n "A". If your task instead concerns selection, use the appropriate selection attribute explicitly. Avoid assuming that a name expression and a selection expression mean the same thing simply because both refer to the same group.
These attributes are inherited from the broader node attribute space, so the node-level reference can provide additional context. For the complete node group attribute list and its examples, see the node group attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
