Easily Select Molecular Groups by Atom Counts in SAMSON

Working with complex molecular systems often means working with large numbers of atoms and intricate structural details. Whether you’re preparing a structure for simulation, analyzing molecular interactions, or customizing visualizations, you may often ask yourself:

“How can I quickly select structural groups with a specific number or type of atoms?”

Fortunately, the Node Specification Language (NSL) in SAMSON allows you to express such selections with precision and ease. In particular, the structuralGroup attribute space provides a powerful yet simple way to filter and highlight groups based on the number of atoms inside them, including atom types like Carbon, Hydrogen, Oxygen, and more.

Selecting groups by total atom count

Suppose you’re interested in all structural groups with fewer than 100 atoms. You can write:

To select groups with, say, from 100 to 200 atoms, use:

This is particularly useful for excluding outliers like solvent molecules or extremely large assemblies when focusing on medium-sized structures.

What about specific elements?

The NSL allows you to go deeper and filter by atoms of a particular element. Here are some useful field codes:

  • sg.nC – number of Carbon atoms
  • sg.nH – number of Hydrogen atoms
  • sg.nO – number of Oxygen atoms
  • sg.nN – number of Nitrogen atoms
  • sg.nS – number of Sulfur atoms

Need all groups with fewer than 10 Oxygen atoms? Try:

Or groups containing between 10 to 20 Hydrogen atoms?

This atom-based filtering can accelerate many workflows such as identifying functional groups, verifying molecular models, or ensuring structural balancing before simulations.

A note on coarse-grained modeling

If you’re working with coarse-grained representations of molecules, you’ll appreciate the sg.ncga filter, which stands for “number of coarse-grained atoms.” Want all structural groups that contain between 100 and 200 coarse-grained particles?

Tips for combining filters

Combine conditions using logical operators (e.g. and, or) for compound queries. For example, to find structural groups with more than 50 total atoms and at least 5 nitrogens, you might write:

Once these groups are selected, you can easily apply visual styles, run calculations, or export them directly from SAMSON.

Conclusion

Knowing how to use NSL selectors like sg.nat, sg.nC, or sg.nO can save you time and clicks, bringing more clarity into your workflow. Whether refining force field assignments or setting up exclusions, precise group selection is a cornerstone of molecular modeling.

Learn more in the SAMSON documentation.

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

Comments are closed.