How to Quickly Filter Molecular Folders by Atom Count, Charge, and More in SAMSON

Molecular modelers often face the need to sift through large sets of structures to isolate the ones relevant for their study. Whether you’re preparing a subset of molecules for dynamics simulations, visual analysis, or quantum calculations, it helps a lot to be able to filter structures based on well-defined criteria—like the number of atoms, molecular composition, or charge.

In SAMSON, the Node Specification Language (NSL) offers a powerful, concise way to do just that. This blog post focuses on how you can filter folder nodes using NSL based on their attributes—such as the number of atoms, formal or partial charge, or specific element counts—without writing long scripts or using external tools.

What Are Folder Attributes?

In SAMSON, a folder node can contain molecular structures. Each folder has accessible attributes—some inherited (like visible, hasMaterial), and some specific (such as numberOfAtoms, formalCharge, numberOfHydrogens, etc.).

Using NSL, you can type short queries in the selection field (or scripts) to select only folders matching your criteria.

Useful Filtering Examples

Let’s go through some useful examples of queries that help with common tasks in molecular modeling:

1. Filter by Atom Count

If you want to select only folders containing fewer than 1000 atoms, you’d write:

If you want a range, say between 100 and 200 atoms:

2. Filter by Number of Specific Elements

For folders containing 10–20 Hydrogen atoms:

Or fewer than 10 Carbon atoms:

3. Filter by Formal or Partial Charge

If you need molecules that have a formal charge between +6 and +8:

Or with a partial charge between 1.5 and 2.0:

4. Filter by Molecular Complexity

To filter structures with more than 4 structural models:

Or to target folders with 10 to 13 structural groups:

Why This Matters

Manually inspecting or processing large molecule sets can be tedious and error-prone. The examples above show that SAMSON’s folder attributes and NSL let you reduce the dataset to just what you need, fast. This saves time, reduces memory usage, and makes interactive modeling smoother.

More Than Just Filtering

These attributes can also work in combination. You could, for instance, select folders that are both visible and contain more than 200 atoms:

The ability to chain conditions together helps target a very specific set of structures instantly.

Final Thoughts

Folder-level attribute filtering in SAMSON helps streamline your molecular modeling workflow. Instead of selecting nodes manually or writing external scripts, you can express powerful filters directly in the interface—making it especially useful when handling large sets of imported or generated structures.

To learn more, visit the original documentation page: https://documentation.samson-connect.net/users/latest/nsl/folder/

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

Comments are closed.