Molecular modelers often work with very complex systems, frequently involving large biomolecules, materials, or supramolecular assemblies. Navigating these models efficiently often depends on the ability to select and manipulate parts of the system based on their structural or logical organization.
In SAMSON, a powerful way to manage complex molecular systems is through node groups. These are collections of nodes (atoms, bonds, molecules, etc.) that can be treated as a single unit. When the system starts growing large, being able to query these node groups becomes essential.
The Node Specification Language (NSL) in SAMSON includes a specific attribute space for node groups, referred to by the short name ng. By filtering based on the attributes of node groups, modelers can isolate parts of the system quickly—for example, selecting all node groups whose name starts with “L” or only those currently selected in the viewport.
Why does this matter?
If you’re working on a molecular machine with repeated components or a multi-drug system, different logical groupings (e.g., all ligands, all protein subunits, etc.) are often created during model construction. Manually finding and selecting them each time is error-prone and time-consuming. NSL solves this with precise, scriptable selection attributes.
Three practical filters you need to know
The ng attribute space supports the following key filters:
ng.n(name): filters node groups based on their name (string, including wildcards like ‘*’).ng.selected: filters node groups based on whether they are currently selected.ng.sf(selectionFlag): filters based on the internal selection flag (true/false).
1. Selecting by name
You can select node groups whose names match a specific pattern. For example:
|
1 |
ng.n "L*" |
selects all node groups with names starting with “L”—commonly used to grab all ligands in your system.
2. Currently selected groups
Want to know which node groups you manually selected in the viewport?
|
1 |
ng.selected |
This expression will match only those node groups. You can also invert it:
|
1 |
not ng.selected |
to perform actions on everything else.
3. Advanced flag-based selection
The selectionFlag is particularly useful when working inside scripts or during automated workflows:
|
1 |
ng.sf true |
This queries node groups that were selected internally by certain tools or filters that use this flag. It provides a layer of selection separate from the visual/manual selection.
Example use case
Imagine you are working on a simulation involving four ligand candidates named “L1”, “L2”, “L3”, and “L4”. You placed them into separate node groups during modeling. Later, you’re asked to extract data only for the ligands. With the following NSL query:
|
1 |
ng.n "L*" |
you can instantly isolate all ligands, regardless of how large the rest of your system is. This drastically reduces the time needed for selection and increases reproducibility of operations.
Where to next
You can combine node group filters with other node-level filters for more advanced querying. For example, to select atoms inside node groups whose name starts with “L”:
|
1 |
ng.n "L*" and a |
where a designates atoms. This allows pinpoint control for scripting, selection, and visualization.
Explore more on this topic in the official documentation: Node Group Attributes in SAMSON.
SAMSON and all SAMSON Extensions are free for non-commercial use. Learn more and download it at https://www.samson-connect.net.
