Working with complex molecular systems often means dealing with large, tangled visual representations. When atoms, residues, and molecular surfaces overlap in your viewport, even the most beautiful structures become hard to interpret. This is a common problem molecular modelers face: how do you control what’s visible—and how it’s visible—without losing your mind?
If you’re using SAMSON, the integrative molecular design platform, there’s a neat way to control visibility using the Node Specification Language (NSL). This blog post explains how to manipulate molecular visuals efficiently using the visible, visibilityFlag, hidden, and selectionFlag attributes in the visual model’s attribute space.
What is the Visual Model Attribute Space?
In NSL, the visual model attribute space is referred to as visualModel or, simply, vm. It allows you to query only the visual model nodes you’ve selected. This is especially useful for isolating visual representations from structural data, such as focusing on surfaces while ignoring the atom-level details.
Decoding Visibility Control Attributes
Here’s a breakdown of the available visibility-related attributes you can use with vm:
vm.v(visible): Returnstrueif the visual model is currently visible. Usenot vm.vto find hidden visuals.vm.vf(visibilityFlag): Check or set the visibility flag. This is more about intent: the model may have been flagged as visible or invisible, even if overriding context hides it.vm.h(hidden): A mirror ofvisible, but phrased oppositely.vm.histrueif the object is hidden.vm.sf(selectionFlag): Indicates whether an object is flagged for selection, which can affect bulk selection and manipulations.
Practical Use Cases
Let’s say you’re working with a protein-ligand complex and want to simplify your scene by hiding all electrostatic surface visuals. Assuming they are named using a consistent pattern (like starting with “ESP”), you can enter this query in SAMSON:
|
1 |
vm.n "ESP*" and vm.v |
This selects all visible visuals whose name starts with “ESP”. To hide them, simply apply a visibility operation in the SAMSON interface or mark them as hidden using scripting.
Similarly, you can query for all visuals that are currently not visible to troubleshoot rendering issues:
|
1 |
not vm.v |
Why Use These Attributes?
When your project contains dozens—or hundreds—of visual models, controlling their visibility through manual toggling becomes overwhelming. NSL queries using vm help you:
- Automate visual cleanup before rendering high-quality images
- Create reproducible scene setups for comparisons or presentations
- Reduce cognitive load by hiding irrelevant components
Used wisely, these attributes improve your experience in SAMSON and help you focus on molecular insights rather than visual clutter.
To explore more about these attributes, visit the official SAMSON documentation page here.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
