When working with complex molecular systems, it’s often necessary to focus on specific entities depending on their characteristics—for instance, filtering out molecular paths that meet a certain level of structural detail. If you’re using SAMSON and dealing with large conformational spaces, being able to select paths based on their number of atoms can save time and reduce the cognitive load when analyzing or modifying datasets.
This short guide introduces you to the path.numberOfAtoms attribute—also accessible via its shorter form p.nat—in the Node Specification Language (NSL) of SAMSON, and shows how it can be used to filter paths efficiently in your selections.
Why filter paths by the number of atoms?
Imagine you’re working with a biomolecular simulation that involves a collection of conformational states. Some of these paths correspond to small transitions, others are more structurally complex. When setting up analyses, assigning force fields, or even visualizing large datasets, you may only want to focus on more detailed conformations, or skip over paths that are too small (perhaps containing just a few atoms).
Rather than manually inspecting hundreds of paths, you can automate this through the p.nat attribute using NSL.
Filtering with p.nat: examples
The path.numberOfAtoms attribute makes it easy to filter paths by specifying numerical conditions. Here are some helpful patterns you can use:
p.nat > 100: selects all paths that contain more than 100 atoms.p.nat 100:200: selects paths with a number of atoms between 100 and 200, inclusive.p.nat <= 50: selects all paths with 50 atoms or fewer.
This functionality becomes especially practical when coupled with other NSL selectors. You might, for example, combine selectors like this:
|
1 |
p.nat > 150 and p.selected |
This would return only those paths that both have more than 150 atoms and are currently selected in your workspace.
Short names help speed things up
When using NSL in practice, brevity can make a big difference in daily workflows. Instead of writing path.numberOfAtoms, you can use p.nat. SAMSON’s short names reduce typing and increase readability during queries—especially when combining multiple attribute checks.
When should you use this?
This kind of atom-count filtering is helpful when:
- You’re scripting automated selections for visualization or export
- You only want to focus on structurally significant paths
- You need to prepare inputs for simulations or analysis tools that have size requirements
Even in visualization tasks—say, hiding all paths below a certain size threshold—the p.nat selector improves user control and reproducibility.
Final thoughts
If you often find yourself manually scanning through path nodes to identify conformations of interest, or entering metadata by hand, try using p.nat queries instead. Once you’re familiar with it, this selector can help you streamline common molecular modeling tasks and maintain consistency across simulations.
To learn more about all available NSL path attributes, check the official documentation for NSL path attributes.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
