Making molecular modeling cleaner with visual model visibility flags

When dealing with complex molecular systems, visual clarity is often one of the most underestimated challenges. Whether you’re inspecting molecular interactions or preparing a figure for publication, it’s easy to end up with a cluttered view filled with overlapping atoms, bonds, and surfaces.

This is where the ability to programmatically control visibility becomes very helpful. If you’re using SAMSON, the integrative molecular design platform, the vm.v, vm.vf, and vm.h attributes in the Node Specification Language (NSL) provide just that control, specifically for visual model nodes.

Understanding the three visibility controls

SAMSON provides three important boolean attributes in the visualModel (vm) attribute space to manage visibility:

  • vm.v (visible): Retrieves whether a visual model is actually being drawn. Use it to test visibility directly, e.g., vm.v or not vm.v.
  • vm.vf (visibility flag): Determines whether the visual model can be drawn. A model might be set to draw, but if vm.vf is false, it won’t be visible.
  • vm.h (hidden): An intuitive negation: if vm.h is true, the node is hidden. This is essentially an alias and can be used for readability depending on your query logic.

Applying this in practice

Say you’re preparing a figure with selected molecules and only want to display the surfaces of a few visual models with customized materials. Instead of toggling things manually, you can use NSL queries within SAMSON to keep your scene organized:

You can combine these with other attributes too:

This allows you to dynamically change how your scene looks based on logical operations rather than manual clicking, saving time and avoiding visual overload. It’s particularly helpful in workflows involving scripting or repetitive model setups.

When visibility != drawability

The distinction between vm.v (visibility) and vm.vf (visibility flag) is small but important. A visual model might technically be visible (vm.v = true) if the conditions allow it to be drawn. But if vm.vf is false, even if the visibility is true, nothing will show up.
This is useful when managing batch operations where models should be prepared in advance but revealed only under specific conditions.

Keep things readable

If you’re asking yourself whether to use vm.v or vm.h, remember that:

  • not vm.vvm.h

It’s a matter of preference. Some find vm.h makes intention clearer, especially when writing logic like:

This kind of query quickly becomes useful when navigating large biomolecular systems with many visual representations (e.g., surfaces, ribbons, trajectories).

Conclusion

Managing visibility efficiently is one of the easiest ways to reduce visual noise and focus on your data. Whether hiding specific representations, preparing publication-ready figures, or scripting views for automation, NSL provides a fast and readable way to control your scene attributes.

To learn more about visual model attributes in SAMSON, visit the official documentation page.

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

Comments are closed.