How to Quickly Select Paths by Atom Count in SAMSON

When working with complex molecular systems, it’s common to deal with thousands of atoms and multiple conformations. If you’re trying to isolate only those paths that include a specific number of atoms—say, for comparing structural motifs or focusing simulations—you might find yourself manually inspecting paths or scripting your own filters. Fortunately, the Node Specification Language (NSL) in SAMSON makes this task a lot faster, and far less error-prone.

Why filter by atom count?

Whether you’re analyzing repetitive fragments across different conformers or setting up a simulation with size thresholds, the number of atoms in a path is a deciding factor:

  • It helps reduce computational cost by excluding large conformers early on.
  • You can compare structures based on size-relevant insights.
  • It enables more accurate visualization when focusing on structures within a specific size range.

The numberOfAtoms attribute

SAMSON’s Node Specification Language (NSL) has a handy attribute: path.numberOfAtoms, abbreviated as p.nat. This attribute lets you select all conformational paths that match a specific number of atoms, or fall within numerical ranges. It’s part of the path attribute space and makes a surprising difference in productivity for molecular modelers.

Usage Examples

Let’s go over a few examples to get a feel for how it works:

  • p.nat > 100 — This matches all paths with more than 100 atoms.
  • p.nat 100:200 — This selects paths where the number of atoms is between 100 and 200.

These compact statements can be used in selection queries throughout the SAMSON interface, and allow for extremely fast filtering. For instance, you can combine the p.nat filter with other path attributes such as name or selected to build multi-criteria filters.

A practical example

Imagine you’ve imported a set of ligands and each is associated with several conformations. You want to only examine those conformations with a moderate number of atoms—say 120 to 160—because these are chemically relevant in your case. Instead of manually opening and checking each one, enter the following:

p.nat 120:160

This instantly reduces visual clutter and allows you to focus on the conformations that matter to your current analysis.

Common pitfalls

  • Don’t confuse p.nat with the number of atoms in the entire document. It only applies to individual conformational paths.
  • Make sure you’re in the right context when applying these queries. The attribute space p matches only conformation nodes.

Learn more

Want to dig deeper into other attributes you can use in NSL, including names and selection flags? Check out the official documentation page here: https://documentation.samson-connect.net/users/latest/nsl/path/

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

Comments are closed.