Finding the Right Groups in SAMSON Using Node Group Attributes

When modeling complex molecular systems, quickly finding the right groups of atoms or structures becomes essential. Whether you’re analyzing secondary structures, comparing ligand sets, or managing subsets of your scene, being able to search, filter, and select groups efficiently can save both time and headaches.

In the SAMSON Node Specification Language (NSL), node group attributes provide a concise and powerful way to target node groups in your document. In this post, we’ll explore how to use these attributes to simplify group selection tasks in SAMSON, especially during repetitive or large-scale modeling workflows.

What Is a Node Group in SAMSON?

In SAMSON, a node group is a special kind of node that groups several other nodes together, such as molecules, residues, or atoms. These groupings are particularly useful when you want to apply operations—like selection or analysis—to multiple nodes in one action.

The Node Specification Language (NSL) allows you to define conditions to match these groups using attributes from the nodeGroup attribute space, abbreviated as ng.

Attributes You Can Use

The main node group attributes available for filtering include:

  • name (short: n): Matches group names using strings. You can use wildcards like * for flexible searches.
  • selected: Checks whether a group is currently selected in the SAMSON interface. Unlike node.selected, this version doesn’t have a short name.
  • selectionFlag (short: sf): Reflects whether the selection flag is set, useful for parsing user-selected groups or scripting selective operations.

Examples in Practice

Here are a few examples of how you might use these attributes:

  • ng.n "A" — Selects node groups with the exact name “A”.
  • ng.n "L*" — Selects node groups whose names start with L (like Ligand1, Ligand2, etc.).
  • ng.sf — Selects node groups with the selection flag set to true.
  • not ng.selected — Identifies node groups that are not currently selected.

By combining these filters, you can create precise queries that match only what you need. For example, ng.n "L*" and ng.sf would let you find ligand-like groups that have been explicitly flagged for selection.

Why This Matters for Molecular Modeling

When your molecular system contains hundreds or thousands of elements, visual selection becomes overwhelming. Being able to type a short query like ng.selected or ng.sf makes it practical to instantly zero in on meaningful subsets—without needing to manually click through layers of atoms and residues.

For tasks like batch simulations, custom visualization workflows, or focused data export, node group attributes are a reliable and efficient way to navigate complexity.

To learn more about all available node group attributes and how they inherit behavior from general node attributes, visit the Node Group Attributes documentation page.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON from samson-connect.net.

Comments are closed.