Selective Visibility in Molecular Models: A Simple Way to Focus on What Matters

Molecular modelers often face a common challenge: navigating through visually complex structures to focus on specific parts of interest. Whether you are preparing figures for presentations, examining a ligand-binding site, or trying to identify specific substructures, controlling what is visible—and what isn’t—is an essential skill. In this post, we’ll explore how to selectively manage the visibility of components using the visualModel attribute space in SAMSON’s Node Specification Language (NSL).

The visualModel attribute space (vm) in SAMSON is designed to match only visual model nodes. These nodes represent the graphical representations of molecular structures and allow fine control over what is shown in the viewport. Understanding how to manipulate visibility-related attributes can help molecular modelers reduce visual clutter and focus on molecular features of interest.

Visibility attributes you should know

Here are the key attributes in the visualModel space that directly affect visibility:

  • vm.visible (v): Indicates if the visual model is currently visible. You can use not vm.v to find hidden components.
  • vm.hidden (h): Similar to vm.visible, but logically reversed. Use vm.h to find hidden visual models.
  • vm.visibilityFlag (vf): A flag that can be toggled to programmatically control visibility. This is useful for bulk operations.

Together, these attributes allow powerful filtering and control. For example, if you want to isolate and examine only the elements currently displayed in your scene, you can use:

To find components that are currently invisible, simply invert the condition:

Example: Hiding background models

Let’s say you have a large molecular complex, but only a subset of it is relevant for your current analysis. You might want to hide all water molecules and ions that create background noise in visualizations. If these are grouped in a visual model with the name “Solvent”, you can search for it using:

Once identified, you can toggle their visibility by setting vm.v = false (in scripts or GUI-based controls if available). This ensures your viewport remains clean and focused.

Additional control with visibilityFlag

The visibilityFlag attribute (vm.vf) offers even more granular control when automating visibility management. For example:

This condition helps you check which visual model nodes have their visibility disabled, even if they still exist in the node structure. This is particularly helpful when developing scripts or complex workflows where automated control is needed.

Keep your scenes clean and comprehensible

By learning to use visibility-related attributes in the vm space, you unlock the ability to declutter your working scene and concentrate on what truly matters. These filters can be used geographically (focusing on nodes within a region), categorically (e.g., visual models only), or functionally (e.g., all currently visible or hidden objects). Whether you are scripting repeated tasks or interactively exploring a structure, these tools can save time and improve clarity.

To learn more about the complete set of attributes in the visualModel attribute space, visit the full documentation page: https://documentation.samson-connect.net/users/latest/nsl/visualModel/.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.