If you work with complex molecular systems, you’ve likely faced the challenge of cleaning up crowded views. Structures with hundreds or thousands of molecules can overwhelm your workspace and slow down your workflow. Whether you’re analyzing a protein-ligand interaction or visualizing a synthetic system, sometimes all you need is to isolate specific elements based on their visibility or selection status—without endlessly clicking through the hierarchy.
This is where SAMSON’s Node Specification Language (NSL) offers a clean solution using logical visibility and selection-based filters for molecule nodes. Let’s explore how you can use these features to your advantage.
Filtering Molecules by Visibility Status
Within SAMSON’s NSL, molecule nodes inherit a set of visibility-related Boolean attributes from the generic node attribute space. These include:
visible(mol.v): Whether the molecule is currently visible in the viewport.hidden(mol.h): Whether the molecule has been manually hidden.visibilityFlag(mol.vf): A flag controlling rendering visibility.
For example, if you want to select only molecules that are currently visible, you can use:
|
1 |
mol.v |
If you want to exclude hidden molecules:
|
1 |
not mol.h |
Need to find invisible molecules for debugging display issues? Try:
|
1 |
not mol.v |
Working with Selection Flags
You can also filter based on whether a molecule has been selected:
selected: True if the molecule is selected. Example:
|
1 |
mol.selected |
selectionFlag(mol.sf): A more technical flag indicating selection status or behavior in logical expressions.
|
1 |
mol.sf false |
These attributes allow you to automate selection, export, or analysis operations on large systems.
Time-Savers in Practice
Let’s say you’re analyzing a molecular dynamics result and exported multiple conformers. You want to only apply a material color (or remove it) to visible molecules. Using NSL, you can write conditions such as:
|
1 |
mol.v and not mol.hm |
This means: modify only molecules that are visible AND don’t already have a material assigned to them.
Or maybe you want to hide all unselected molecules for clarity. Easy:
|
1 |
not mol.selected |
Select those, and then hide them.
By chaining such expressions, NSL turns the molecular scene into a manageable dataset for fast operations.
Documentation at a Glance
Here’s a table summarizing the most commonly used visibility-related attributes:
| Attribute | Short name | Values | Use case |
|---|---|---|---|
| visible | v |
true / false | Filter molecules currently visible in the view |
| hidden | h |
true / false | Identify manually hidden molecules |
| selectionFlag | sf |
true / false | Filter based on programmatic selection flags |
| selected | (none) | true / false | Check if molecule is currently selected |
Combining these logical queries allows you to take full control of your molecular setups with minimal friction, making large scene management far easier than relying only on visual intuition or manual editing.
Learn more from the official documentation here.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
