Easily Find Segments by Atom, Element, or Charge: NSL Tips in SAMSON

Working on complex biomolecular assemblies or large molecular structures often means dealing with thousands of segments, each potentially composed of hundreds of atoms. When your project grows, so does the need to filter segments efficiently—whether to visualize specific chemical features, isolate a functional region, or simply streamline your workflow for selection and analysis.

If you’ve ever wondered how to quickly find polymer segments with high carbon content, or identify those with specific charges or atom counts, then this post is for you. SAMSON’s Node Specification Language (NSL) makes this easy with precise, composable filters applied directly to molecular segments (like proteins or coarse-grained polymers).

Why focus on segments?

Segments in SAMSON typically correspond to higher-order molecular structures such as strands, chains, or other modular units. Being able to search and filter based on segment attributes helps molecular modelers focus on sections of interest, bypassing the tedious navigation of hierarchical graphs.

Useful attributes you can use for filtering segments

Segment nodes expose numerous attributes related to their structure and metadata. Here’s a useful selection with example queries:

1. Number of residues

  • s.nr > 100: matches segments with more than 100 residues
  • s.nr 90:120: matches segments with 90 to 120 residues

2. Atom composition

  • s.nC > 15: segments with more than 15 carbon atoms
  • s.nH 50:60: segments with between 50 to 60 hydrogen atoms
  • s.nO < 10: segments with less than 10 oxygen atoms

3. Formal and partial charge

  • s.fc < 0: segments with negative formal charges
  • s.pc 1.5:2.0: segments with partial charges between 1.5 and 2.0

Example workflow idea

Imagine you are studying polymer chains and want to detect regions that:

  • Have more than 120 residues
  • Contain a significant number of oxygen atoms (e.g., more than 25)
  • Possess a partial charge over 1.5

With NSL in SAMSON, you can create a compound filter such as:

This filter instantly gives you the segments meeting all three criteria across your molecular system.

Combining visibility and ownership filters

NSL also lets you restrict your queries to visible segments or ones that own their graphical materials. For example:

  • s.v and s.om: visible segments that own materials
  • not s.h and s.fc > 1: segments that are not hidden and have a formal charge greater than 1

Pro tips

  • Use wildcards in the name attribute: s.n "A*" will match any segment with a name starting with “A”
  • Remember that you can combine multiple conditions using logical operators like and, or, and not.

Whether you’re setting up a selection for export, preparing data for machine learning, or just trying to simplify your scene, NSL gives molecular modelers quick, composable tools to filter segments based on meaningful chemical and structural properties.

To learn more and explore the full set of segment attributes, visit the official segment attributes documentation in SAMSON.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON here.

Comments are closed.