If you’ve worked with complex molecular systems, chances are your document becomes cluttered with multiple structural models. Models become hidden, toggled on and off, or simply lost in a forest of atoms and molecules. If you’ve asked yourself, “Which of these structures are actually visible right now?”, this post may save you time and frustration.
The Node Specification Language (NSL) in SAMSON provides powerful tools to query specific structural models based on their visibility attributes. Whether models are hidden manually or automatically, knowing how to filter them correctly can help you focus on the components that really matter for your task.
Why visibility matters in molecular modeling
Visibility attributes are especially useful when working with large simulation systems or assemblies composed of many elements. Common use cases where they come in handy:
- You want to compute properties for currently visible models only
- You need to isolate hidden elements for debugging or organization
- You want to create clean visual exports without redundant models
Search by visibility in seconds
In NSL, the visible attribute filters structural models based on their visibility status. Its short name is v, and it belongs to the structuralModel attribute space, so it is accessed via sm.v.
To select all visible structural models, simply type:
|
1 |
sm.v |
To select all hidden structural models (perhaps to delete or analyze them):
|
1 |
not sm.v |
This query instantly returns only the matches. No need to scroll through the Document view or manually click through dozens of models.
Diving deeper: visibility flags vs. visibility
Beyond simple true/false visibility, NSL also provides the visibilityFlag (vf) attribute:
|
1 |
sm.vf false |
This enables a more nuanced check: for instance, determining whether visibility has been explicitly set or inherited. This is useful when working with hierarchical visibility states across parent/child nodes.
Combining with other filters
You can combine visibility with any other attributes in NSL. For example, to retrieve visible structural models with more than 100 atoms:
|
1 |
sm.v and sm.nat > 100 |
Or to find hidden models with many residues (perhaps mistakenly hidden):
|
1 |
not sm.v and sm.nr > 50 |
A small change, big clarity
These visibility filters might seem small, but they can offer large clarity on what’s actually present in your working space. Rather than navigating visually through increasingly complex molecular trees, a single line of NSL can bring order to your scene.
Learn more about structural model attributes in the full NSL documentation here: https://documentation.samson-connect.net/users/latest/nsl/structuralModel/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
