Find the Right Node Groups Without Chasing Every Node

When a molecular scene gets busy, it is easy to lose track of which parts of the model you mean to work with. A query that is too broad can return the wrong kind of node; a query based only on a name may leave it unclear whether you are targeting a group or something else. SAMSON’s Node Specification Language (NSL) provides a focused way to describe node groups using the nodeGroup attribute space, abbreviated ng.

Start by naming the kind of thing you want

The most useful detail to remember is that ng matches only node group nodes. That makes the attribute space a good starting point when your task is specifically about groups: it keeps the intention of the query visible instead of leaving the target type implicit.

For example, the documented expression ng.n "A" uses the short name n for the group’s name attribute. The page also gives ng.n "L*" as an example. If you are adapting either expression, keep the quotes around the name value, and check the NSL reference for the precise matching behavior you need.

Choose the right selection attribute

Node groups inherit two selection-related attributes from the general node attribute space: selected and selectionFlag. They are separate attributes, so it is worth choosing deliberately rather than treating them as interchangeable.

To query the selected state, the documented examples are ng.selected and not ng.selected. These let you express the positive and negative cases directly. A practical way to avoid mistakes is to read the expression aloud: “node group is selected,” or “node group is not selected.” The explicit not is especially helpful when reviewing a query later.

For selectionFlag, the short name is sf. The examples ng.sf and ng.sf false show how to refer to the attribute and how to specify a false value. The attribute is inherited from node.selectionFlag; the node-group reference does not define its behavior further, so consult the node attribute documentation if you need to understand what the flag represents in a particular workflow.

A quick check before using a query

  • Target: Use ng when the objects you want are node groups.
  • Name: Use ng.n followed by a quoted value, as in ng.n "A".
  • Selection state: Use ng.selected or not ng.selected when you mean the selected attribute.
  • Flag: Use ng.sf when you mean selectionFlag, not selected.

This small distinction can make a query easier to understand and maintain: the prefix identifies the node-group target, while the attribute tells you whether you are filtering by name, selected state, or selection flag. When something does not match your expectation, inspect those two pieces separately before changing the whole expression.

For the full attribute table and additional context, see the node group attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.