When working with molecular structures, modelers frequently face a common challenge: selecting specific groups of atoms based on complex spatial or chemical criteria. Scrolling through long atomic lists, manual picking, or relying on external scripts can be tedious and error-prone, especially for large systems or intricate geometries like proteins, nanotubes, or functionalized materials.
Thankfully, SAMSON offers a lightweight yet powerful solution with its Atoms Selector Extension. Using simple mathematical expressions, you can precisely and reproducibly define which atoms to include in your selection—making structural analysis and editing significantly easier.
What it Does
The Atoms Selector Extension allows you to select atoms from the active document using a rich set of predefined variables and mathematical expressions. It uses the same scripting logic as the Simple Script Extension, but is tailored to selection only. This keeps the interface streamlined while offering advanced control.
For example, if you need to select all atoms within a cylinder of radius 10Å centered at (15, 15), simply input:
|
1 |
((a.x - 15)^2 + (a.y - 15)^2) < 100 |
This selects all atoms within the circular cross-section of the cylinder (since 10^2 = 100). You can combine this with additional conditions if you want to restrict by height (z-axis), element type, or atom ID.

Why It’s Useful
Generic selection tools are often not enough when working with large biomolecules or nano-materials. You might want to:
- Select backbone atoms of an alpha helix segment.
- Select all iron atoms with occupancy > 0.8.
- Select water molecules within 5Å of a ligand.
- Select only carbon atoms past a certain Z-plane for visualization.
All of this is possible using basic math and logical conditions. For example:
a.element == 'Carbon' and a.z > 10a.water == true and a.occupancy > 0.8
This scripting system is highly readable, and since all variables and function names are case-insensitive, it prevents common user errors. And if you’d like to perform changes—not just selections—you can easily upgrade to the Simple Script Extension.
Tip: Use it as a Custom Filter
The Atoms Selector Extension is perfect for filtering out atoms before structural analysis, simulations, or exporting subsets. Combine it with visual tools in SAMSON to build insightful representations and simulations faster.
To learn more or explore additional examples, please visit the full documentation page: https://documentation.samson-connect.net/tutorials/simple-script/making-nano-batarangs-and-more/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
