Find the right node group without losing track of selection

When a molecular scene contains many node groups, a small filtering mistake can send you back to hunting through the structure tree. A group may have the name you expect but not be selected; alternatively, it may be selected when you meant to find groups that are not. SAMSON’s Node Specification Language (NSL) lets you target node groups by name and check their selection-related attributes.

The key starting point is the nodeGroup attribute space, abbreviated ng. It matches node group nodes, so using this prefix makes your intent clear: you are querying groups rather than every kind of node.

Match a group by name

Use ng.n as the short form of the name attribute. The value is written as a quoted string. For example:

  • ng.n "A" refers to a name value of A.
  • ng.n "L*" is another documented name expression.

If a query does not return the group you expect, first check the attribute prefix and the quotation marks. The short name is n, but it still needs the ng attribute-space prefix to specify that you are looking at node groups. The documentation includes L* as an example; consult the NSL reference if you need to determine how pattern matching behaves in your particular query.

Check selected state explicitly

The group attribute selected is inherited from the general node attribute space. For node groups, it is written as ng.selected, or negated as not ng.selected. Unlike some node attributes, selected has no short name in this group attribute space.

That makes the full spelling useful when you want a query to be easy to read later. For example, ng.selected plainly indicates that the condition concerns selection state, while not ng.selected expresses the opposite condition. When reviewing a saved query, spellings like these can help distinguish a selection check from a name match.

Know the selectionFlag spelling

selectionFlag is also inherited from the node attribute space. Its short name is sf, and the documented examples are ng.sf and ng.sf false. Both selected and selectionFlag accept Boolean values, but they are separate attribute names in the reference. Avoid swapping one for the other just because both relate to selection; use the attribute that matches the condition you intend to express.

A quick troubleshooting routine

  1. Confirm that the objects you want to match are node groups. The ng prefix is specifically for node group nodes.
  2. For a name-based check, use ng.n and put the string in quotes.
  3. For selected state, use ng.selected or not ng.selected; do not expect a short form for this attribute.
  4. For the selection flag, use ng.sf or provide a Boolean value, as in ng.sf false.

This small checklist helps separate three common sources of confusion: querying the wrong node type, using the wrong attribute spelling, and mixing up the two selection-related attributes. The reference page lists the supported names, short names, values, and examples for node groups. Read the node group attributes documentation to learn more.

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

Comments are closed.