When working on complex molecular models, locating specific groups of atoms or molecules quickly can save precious time and effort. Whether you’re setting up a simulation, cleaning up a scene, or preparing a figure for publication, repetitive clicking through hierarchical structures is not just tedious—it increases the risk of overlooking important elements.
Fortunately, the Node Specification Language (NSL) in SAMSON offers a simple solution: node group attributes that let you query and filter node groups using clear, intuitive expressions. Let’s take a closer look at how this can streamline your molecular modeling workflows.
What Is a Node Group?
A node group is a special type of node in SAMSON that organizes other nodes (like atoms, molecules, or visual models) into logical collections. For example, you could group all water molecules in a system, or all atoms of a protein backbone.
NSL uses the attribute space nodeGroup (short name: ng) to target these nodes specifically.
Useful Node Group Attributes
There are three main attributes used to filter node groups:
- name (
ng.n): Matches node groups by name with support for wildcards. - selected: Checks if the node group is currently selected (no short name).
- selectionFlag (
ng.sf): A boolean flag that gives you more fine-grained control than just selection status.
1. Finding Node Groups by Name
This is especially useful when naming conventions are followed. For example, to find all node groups whose name starts with “Ligand”:
|
1 |
ng.n "Ligand*" |
Or, to find exactly the group named “Water”
|
1 |
ng.n "Water" |
2. Filtering Selected Node Groups
You can easily isolate node groups that are selected in the viewport using:
|
1 |
ng.selected |
Inverse selections are just as simple:
|
1 |
not ng.selected |
3. Using the selectionFlag
The selectionFlag behaves like a label that you can use programmatically. It can be useful for marking node groups you’ve processed, for example during script execution:
|
1 2 |
ng.sf true ng.sf false |
Why Does This Matter?
Let’s say you’ve imported a large molecular system with hundreds of groups—solvents, ligands, ions, membrane layers. Without attribute filtering, identifying just the groups you want (e.g., all ion node groups not currently selected) becomes a time sink.
Instead, with a simple query like:
|
1 |
ng.n "Na*" and not ng.selected |
you instantly identify all sodium-containing node groups that are not selected yet. This can speed up model preparation, simulation setup, and data analysis.
Final Thoughts
The node group attributes in NSL empower you to be more precise and efficient in interacting with your models. Especially in large systems, these tools reduce cognitive load and accelerate your workflow.
To dive deeper into node group attributes and explore more examples, visit the full documentation page here.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON from the official website: https://www.samson-connect.net
