Molecular modelers often need to filter structural elements based on their atomic composition. Whether you’re studying peptides, coarse-grained models, or large macromolecular complexes, being able to select parts of molecules that meet specific atom count criteria can save time and reduce errors.
In this post, we’ll focus on how the Node Specification Language (NSL) in SAMSON helps you pinpoint molecular backbones with precision using numberOfAtoms, numberOfCarbons, numberOfHydrogens, and other similar attributes.
Backbone Attributes for Atomic Filtering
In NSL, the backbone attribute space (short name: s) lets you specify queries that only match backbone nodes. This is especially useful when you only want to filter or select high-level molecular structures.
When dealing with atomic composition, the following attributes—inherited from the structuralGroup attribute space—come into play:
bb.nat– Total number of atomsbb.nC– Number of carbon atomsbb.nH– Number of hydrogen atomsbb.nN– Number of nitrogen atomsbb.nO– Number of oxygen atomsbb.nS– Number of sulfur atomsbb.ncga– Number of coarse-grained atoms
These attributes take integers and support powerful operations such as threshold-based expressions and ranges. Here are some usage examples:
|
1 2 3 4 5 6 7 8 9 |
# Backbones with fewer than 1000 atoms bb.nat < 1000 # Backbones with carbon atoms between 10 and 20 bb.nC 10:20 # Backbones with no oxygen atoms bb.nO 0 |
Why Is This Useful?
Filtering by atomic counts is useful in a variety of scenarios:
- Pre-simulation cleanup: Identify fragments or structural regions with incomplete atomic data.
- Model optimization: Focus on heavily carbonated domains or reduce complexity by trimming surplus hydrogen atoms.
- Visual clarity: Simplify the view by showing only components with a specified size (e.g., nat ≥ 500 atoms).
Atomic filtering also works well in combination with visibility or selection flags:
|
1 2 |
# Show only backbones with > 10 oxygen atoms bb.nO > 10 and bb.v |
Related Attributes
In addition to atom counts, you can also filter by:
formalCharge (bb.fc): Useful in electrostatics analyses.partialCharge (bb.pc): For more fine-grained electronic property filtering.
Quick Tip
You might be tempted to use bb.selected or bb.sf to focus only on currently selected regions, but remember—these are status flags, not structural filters. Combine them when needed, but use them thoughtfully.
Conclusion
Being able to specify molecular backbones by their atomic makeup brings flexibility and precision to your modeling workflow in SAMSON. Try combining these filters for more advanced queries—like isolating coarse-grained models (bb.ncga > 200) with minimal nitrogen content (bb.nN < 5).
To explore all backbone attributes in SAMSON’s Node Specification Language, visit the official documentation here: https://documentation.samson-connect.net/users/latest/nsl/backbone/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
