Mastering Node Group Selection in SAMSON: Simple Rules for Complex Models

When you’re deep into molecular modeling, every saved click counts. Whether you’re preparing structures for simulations, building hierarchical models, or just navigating complex systems, selecting the right node groups efficiently can streamline your workflow. In SAMSON, the Node Specification Language (NSL) gives users powerful ways to query and select model components—but using it effectively requires understanding its nuances.

One such nuance involves the node group attributes. If you’re dealing with grouped nodes (for instance, all atoms in a ligand or various molecular fragments), this set of attributes can help you write cleaner, faster selection rules. Here’s a breakdown of what they are, and how they help in real modeling tasks.

Why Node Groups Matter

In SAMSON, node groups are special containers that group together other nodes. You might use node groups to represent a protein chain, a ligand, or even logical subsets of atoms within a model. Instead of selecting each atom or molecule individually, you can define and manipulate these groups. But how do you reference them efficiently?

This is where nodeGroup attributes (short name: ng) come in. They allow you to fine-tune your selection queries and interact directly with these grouped elements.

Key Attributes for Node Groups

Attribute Short name Values Examples
name n String patterns in quotes ng.n "LigandAlpha"
ng.n "L*"
selected (no short name) true, false ng.selected
not ng.selected
selectionFlag sf true, false ng.sf
ng.sf false

Real Example: Selecting a Specific Ligand Group

Imagine you imported a complex system with several ligands and protein chains. If you’re only interested in node groups with names starting with ‘L’ (e.g., Ligand1, Ligand2), you could use:

This query selects all node groups with names that begin with ‘L’. This avoids selecting individual atoms or bonds and keeps things tidy.

Quick Tip: Boolean Filters

Want to isolate all unselected groups for review or editing? Use:

Or to find everything currently tagged with the selection flag, try:

These queries are especially helpful when you’re scripting actions or enabling conditional visualizations.

Caveat: Short Names Explained

Note that while the name and selectionFlag attributes for node groups have short names (n and sf), selected does not. So watch out for that when crafting your query syntax!

Summary

Using node group attributes helps you:

  • Filter selections with minimal effort
  • Create logical workflows
  • Improve script clarity and maintainability

If you’re starting to write more advanced selection rules or automating model preparations, mastering these minimal selectors can reduce errors and improve speed significantly.

To dive deeper, check out the full documentation page here.

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

Comments are closed.