Filtering molecular models by atom count in SAMSON

When working on large molecular systems, it can be useful – and sometimes necessary – to quickly identify models with a specific atom count. This is particularly relevant when preparing simulations (e.g., optimizing system size), simplifying visualizations, or evaluating model complexity.

In SAMSON, the Node Specification Language (NSL) helps you do just that. It provides a simple way to query structural models programmatically, including filtering by atom count using the numberOfAtoms attribute, or its short version sm.nat.

Why filter by atom count?

Atom count is a quick proxy for the size and complexity of your system. For example:

  • If your simulation software has limits, you can screen for structural models under a threshold.
  • To conduct statistical analysis on model complexity.
  • To isolate a smaller model for faster visualization or debugging.

How to use numberOfAtoms in NSL

In the NSL, all structural model attributes related to atoms are prefixed with sm.. The atom count is represented by numberOfAtoms, or nat for short. Here’s how you can use it:

Example 1: Find all structural models with more than 100 atoms:

Example 2: Select models with an atom count between 100 and 200:

This range syntax is particularly helpful for grouping or filtering models by size.

Combine with other attributes

The real power comes when you combine sm.nat with other attributes. For instance:

Select visible models with less than 300 atoms:

Find models with more than 1000 atoms and more than 10 structural groups:

Tips for using this feature

  • Use sm.nat in combination with visualization filters to simplify large scenes.
  • Pair with sm.nm, sm.nr, and sm.pc for more advanced queries.
  • The short name nat is only valid when used in the context of structural models and should be prefixed with sm..

Filtering molecular models by atom count can significantly improve your workflow when used correctly. It promotes clearer project organization, helps avoid unnecessary processing of overly large models, and makes it easier to apply analytical operations on targeted systems.

To learn more about other structural model attributes and get full examples, check out the full documentation page: https://documentation.samson-connect.net/users/latest/nsl/structuralModel/

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

Comments are closed.