One of the recurring challenges in molecular modeling is quickly locating and analyzing specific segments in large systems. Whether you’re dealing with proteins, nanostructures or complex materials, narrowing your focus to portions of interest often requires repetitive manual selection or scripting — both of which can be error-prone or time-consuming.
If you’ve ever wanted to filter parts of your model based on atom types — for example, to find all segments with more than 8 oxygen atoms or with a limited number of hydrogens — SAMSON’s Node Specification Language (NSL) offers a concise and accessible way to do just that.
Using NSL to Search by Atomic Composition
The segment attribute space in SAMSON helps you target individual segments in a molecular system. It supports a variety of attributes inherited from structural groups, including atom counts of specific elements. If you know the number of atoms you are looking for — or a range — you can filter immediately with a one-liner.
Some useful attributes include:
s.nC: number of carbon atomss.nH: number of hydrogen atomss.nN: number of nitrogen atomss.nO: number of oxygen atomss.nS: number of sulfur atoms
Each of these attributes takes integer values and supports logical operations and ranges. Here are a few helpful examples:
|
1 |
s.nO > 8 |
This matches all segments with more than eight oxygen atoms.
|
1 |
s.nC 10:15 |
This matches all segments with between ten and fifteen carbon atoms, inclusive.
|
1 |
s.nH < 5 |
This filters for segments containing fewer than five hydrogens.
Why This Saves Time
These types of queries can be combined with other segment attributes — for example, visibility (s.v), number of residues (s.nr) or even name matching (s.n "GLY") — making NSL an efficient tool to build rich queries without writing custom code or performing manual selection in large datasets.
Instead of scrolling endlessly through hierarchy trees or using external tools for selections, NSL allows you to stay within SAMSON, and filter your molecular data on the fly, encouraging a more data-driven workflow.
Use Case Scenarios
- Material discovery: Find polymer segments with specific functional elements (e.g., sulfur-rich)
- Drug development: Isolate components that are oxygen-heavy to assess potential polarity
- Protein modeling: Focus on minimal fragments with low hydrogen counts to simplify simulation
You can mix and match these attributes to suit your needs. For example:
|
1 |
s.nO > 10 and s.nH < 5 |
This will target segments that are both oxygen-rich and hydrogen-poor.
To learn more and see the full list of segment attributes, including those that can help filter based on material, visibility, and charge properties, visit the official documentation here: https://documentation.samson-connect.net/users/latest/nsl/segment/
SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at https://www.samson-connect.net.
