When working with a molecular model, a small selection mistake can have a large effect: a query intended for a named group may instead match a different kind of node. Node Specification Language (NSL) helps make the target explicit. For node groups, the key is to use the nodeGroup attribute space, whose short name is ng.
Start by identifying the node type
A node-group query begins with ng. This matters because the attribute space matches only node group nodes. It gives your expression a clear scope before you specify what those groups should be like. For example, ng.n "A" asks for a node group whose name is A.
The full attribute name is name; its short name is n. Both forms refer to the same inherited node attribute. The documentation also shows ng.n "L*" as an example of a name expression. When adapting an example, keep the name in quotation marks and replace the example text with the group name you want to use.
Use the selection state deliberately
Node groups inherit two selection-related attributes: selected and selectionFlag. You can query the selected state with ng.selected, or use not ng.selected to express the opposite condition. This is useful when you want a query to distinguish selected node groups from those that are not selected.
selectionFlag has the short name sf. The reference gives both ng.sf and ng.sf false as examples. Keep the two attributes separate in your expressions: the page lists selected and selectionFlag as distinct attributes, so do not assume that one is simply another spelling of the other.
A quick way to build a query
- Set the scope: begin with
ngso the expression targets node groups. - Choose the property: use
nornameto refer to a group’s name,selectedfor its selected state, orsffor its selection flag. - Check the value: names are written as strings in quotation marks; the Boolean attributes use
trueorfalse. - Read the expression back: confirm that the attribute and value describe the group property you actually mean to target.
For instance, these documented forms illustrate the available choices:
ng.n "A"— a node group namedA.ng.selected— a node group matching the selected condition.not ng.selected— a node group matching the opposite selected condition.ng.sf false— a node group with the selection flag set to false.
One shorthand detail worth remembering
The inherited selected attribute does not have the short name s in the node-group attribute space. That is an easy detail to overlook when moving between attribute spaces. Use ng.selected rather than assuming a shorthand is available. By contrast, the page explicitly lists n for name and sf for selectionFlag.
Keeping scope, attribute, and value distinct makes NSL expressions easier to inspect and revise. If a query does not describe the intended target, check those three pieces independently: are you addressing node groups, using the right attribute, and supplying a value of the correct kind?
For the complete attribute reference, see the SAMSON node group attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
