Quickly Find Molecule Paths by Atom Count in SAMSON

When working with large molecular systems in SAMSON, it’s very common to work with conformation paths. Whether you’re navigating different states of a trajectory or trying to prepare a dataset for analysis, one common challenge is identifying only those paths that meet certain criteria — for example, paths that contain a specific number of atoms. SAMSON’s Node Specification Language (NSL) provides a simple way to do this with precision.

This post introduces how to use the numberOfAtoms attribute (short name: p.nat) from the NSL path attribute space to filter paths based on the number of atoms. This can save you time, especially when working with large, multiscale systems or long molecular dynamics simulations.

Why filter by the number of atoms?

Imagine you are analyzing a trajectory that contains hundreds of conformations, and you want to focus only on those conformations where a specific structural unit (like a ligand or chain) is fully present—or has undergone significant transformation. Many times, such changes are reflected in atom count variations.

For example, you may want to:

  • Select only conformations where at least 100 atoms are present (e.g., to avoid considering partial frames).
  • Identify trajectories or paths where the atom count fluctuates within a specific range.
  • Filter out small fragments automatically without checking them one by one.

Using NSL to filter paths by number of atoms

In NSL, you can access path-specific attributes using the path attribute space (short name: p). The attribute path.numberOfAtoms (shortened to p.nat) lets you specify integer-based conditions.

Examples

  • p.nat > 100 – selects all paths with more than 100 atoms.
  • p.nat 100:200 – selects all paths with between 100 and 200 atoms (inclusive).

These expressions can be typed directly into the NSL filter in any selection or visualization tool that supports node filtering in SAMSON. This allows you to quickly isolate relevant data—without needing to manually process each path.

Benefits in practice

Using p.nat for filtering can be especially useful when:

  • You are cleaning up imported datasets and want to remove tiny fragments or irrelevant paths.
  • You want to locate key conformations that correspond to specific molecular compositions.
  • You are scripting or building workflows that rely on path selection as a preprocessing step.

Because it’s part of the NSL syntax, you can also combine this filter with other attributes—like p.n (name), p.selected, or p.sf (selectionFlag)—to perform more advanced queries, such as:

Which would select all paths related to something whose name starts with “L” and that contains more than 150 atoms.

Where to learn more

To learn more about how to use path attributes in NSL, visit the SAMSON documentation page on path attributes: 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.