When working with complex molecular systems, being able to control what is shown on screen can make a big difference in both user experience and analysis workflow. This is especially true when you’re navigating large biomolecular assemblies or running simulations with many visual cues.
Users of the integrative molecular design platform SAMSON often ask how to quickly show or hide different parts of a molecular model. This blog post clarifies the use of two powerful visual model attributes: visible and visibilityFlag, available in the Node Specification Language (NSL).
Why visibility control matters ðŸ§
Imagine you’re focusing on a ligand binding site but are constantly distracted by other components in your simulation. Or suppose you’re preparing a publication rendering and only need a few key elements visible. In both cases, quickly filtering and isolating elements based on their visibility offers a major time-saver.
The visualModel space
Both the visible and visibilityFlag attributes are part of the visualModel attribute space, accessible via the keyword vm. This space is reserved for visual model nodes, which define how models are graphically represented.
Understanding vm.v: The ‘visible’ attribute
The visible attribute (abbreviated as v) controls whether a visual model is currently shown on screen. It’s a boolean attribute and is straightforward to use:
vm.v→ selects all visible visual model nodesnot vm.v→ selects all invisible visual model nodes
Use this when you simply want to check or filter elements based on what is displayed.
When to use vm.vf: The ‘visibilityFlag’ attribute
Things can become more nuanced. The visibilityFlag attribute (abbreviated as vf) gives you an extra layer of control over the visibility state. While vm.v tells you whether a node is currently visible following all visibility rules, vm.vf focuses on whether the visibility toggle has been explicitly set on that node.
Examples:
vm.vf→ returns nodes with visibility flag set to truevm.vf false→ returns those explicitly set to be hidden
This is particularly useful in batch operations where you need to reset visibility for only a subset of objects, or simply want to diagnose why something is not showing up.
Practical tip 💡
To isolate visible visual models whose visibility has been toggled explicitly by the user, combine both:
|
1 |
vm.v and vm.vf |
This helps differentiate between elements that are visible due to inherited visibility settings, and those for which visibility was set directly.
Conclusion
Fine-grained control over visibility contributes to more intuitive model navigation and cleaner visual outputs. For any molecular modeler wanting to streamline their workspace or focus on specific structures, understanding these attributes is immensely helpful.
To learn more about the visualModel attribute space and other filtering tools in NSL, visit the official documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
