Quickly Filter Molecules by Atom Counts in SAMSON

Working with large molecular systems often means searching through numerous molecules to identify the right structures for your simulations or analysis. A common task for molecular modelers is filtering molecules by the number of specific atoms they contain—for instance, selecting all molecules that contain a certain number of carbon, hydrogen, or nitrogen atoms. If you’ve ever wished for a quicker way to do this without writing complex selection scripts, the Node Specification Language (NSL) in SAMSON might be exactly what you need.

Why This Matters

Determining which molecules in a complex system meet certain criteria—like containing more than 15 carbon atoms or fewer than 5 sulfur atoms—is essential in coarse-grained simulations, polymer studies, or preparing subsets for further analysis. Manually filtering these structures can be repetitive and error-prone, especially in large datasets. NSL simplifies this process using intuitive, readable expressions tailored specifically for structured selection.

Filter Molecules Instantly Using Intuitive Commands

With SAMSON NSL, you can filter molecules based on number of atoms by using the mol attribute space. For example:

  • mol.nC > 10: Select molecules with more than 10 carbon atoms.
  • mol.nH 5:10: Select molecules with between 5 and 10 hydrogen atoms.
  • mol.nN < 3: Select molecules with fewer than 3 nitrogen atoms.
  • mol.nS 2: Select molecules that contain exactly 2 sulfur atoms.

You can use these expressions directly in SAMSON’s advanced selection tools or scripting functionalities, allowing you to build powerful queries quickly.

All Supported Atom Count Filters

Here’s a summary of properties you can filter on within the mol space:

Property Short name Example usage
Number of atoms nat mol.nat < 100
Number of carbons nC mol.nC 10:15
Number of hydrogens nH mol.nH > 30
Number of nitrogens nN mol.nN 1:3
Number of oxygens nO mol.nO = 6
Number of sulfurs nS mol.nS 0:1
Number of coarse-grained atoms ncga mol.ncga 50:150

Use Ranges and Conditions

The NSL supports range queries (e.g., 10:20) and comparison operators (<, >, =), making it easy to express complex filtering conditions in just one line. You can also combine expressions to fine-tune your selection:

Practical Example

Looking for molecules with a carbon count between 12 and 16, at least one nitrogen, and exactly two sulfurs? Here’s how you’d write that:

This expression ensures that only molecules truly relevant to your experiment are highlighted, helping you save time and reduce mistakes.

Conclusion

Filtering molecules by atom count is one of many practical features that NSL in SAMSON offers, and best of all—it requires almost no learning curve. Simple expressions unlock access to sophisticated data filtering, making structural analysis and molecular modeling workflows far smoother.

To explore more filtering options and data attributes, visit the official documentation page.

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

Comments are closed.