Selecting Atoms by Name and Distance in SAMSON with NSL

One of the most common tasks in molecular modeling is selecting specific atoms or residues within complex biomolecular systems. Whether you’re preparing a simulation, visualizing sidechains, or analyzing interactions, precision in selection is essential. Yet, many molecular modelers waste valuable time picking atoms one by one or clicking through a complex graphical interface.

This is where the Node Specification Language (NSL) in SAMSON offers a powerful alternative. With NSL, you can perform advanced selections with just a few keywords, using names, distances, and logical conditions to pinpoint exactly what you’re looking for.

What if you could find all atoms named “CA” within 5 angstroms of a sulfur atom?

In many modeling workflows, such as identifying alpha carbon atoms near specific reactive groups or probing structure-function relationships, you’re looking for spatial relationships between atoms. With NSL, this becomes straightforward:

This NSL expression selects all atoms named "CA" that are within 5 angstroms of any sulfur atom. This includes alpha carbons involved in ligand binding, catalytic triads, or disulfide bonds, for instance.

NSL uses intuitive keywords like within (short version: w) and supports units like angstrom (A), nanometers (nm), and more. That means you can write expressions like:

to find atoms within 0.5 nm of any oxygen atom. These concise expressions save you time while providing accurate, replicable results.

Need to exclude atoms from your query?

Let’s say you’re only interested in atoms near a residue, but don’t want to include atoms from the residue itself. Here’s how:

This selects atoms within 5 angstroms of “GLN 2”, excluding atoms that belong to it. Handy for analyzing the neighborhood of a specific residue without clutter.

More use cases from daily modeling routines

  • Study solvation shells around selected residues: n.t a within 3A of n.s
  • Select residues beyond a radius: n.t r beyond 10A of "ALA 28"
  • Combine with logic: C within 5A of r.t LYS and not H (carbons near lysines, excluding hydrogens)

Visual feedback while typing

Use the Find command in SAMSON (Ctrl+F or Command+F) and start typing your NSL expression. Press the Tab key for context-aware completions that help discover node names and types in your document.

This dialog is also where you can click the “Ask AI” star icon to describe selections in natural language and get suggestions—especially useful if you’re exploring a large structure for the first time.

Select nodes with the Find command

Try it yourself

Pick a large biomolecule, open the Find dialog, and try:

This selects all nodes with “ALA” in their name that are spatially near sulfur atoms—great for assessing proximity in folding studies or analyzing neighboring residues.

For more NSL examples and practical tips, visit the full documentation page on Node Specification Language (NSL).

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

Comments are closed.