Selecting atoms one by one is often the first bottleneck in setting up a molecular experiment or simulation. Whether you’re defining a region of interest, modifying a subset of atoms, or preparing geometric restraints, manual selection can become slow and error-prone, especially with large systems.
The Atoms Selector Extension in SAMSON offers a simple and intuitive solution by letting you define atom selections using mathematical expressions—but without writing a full script. This means you can focus on what you want to select using spatial and atomic properties, and let SAMSON handle the selection logic for you.
Why this tool helps
Many users need to select atoms based on their coordinates, element type, residue identifiers, or even their visibility and charge. For instance:
- Cut a slice from a bulk material
- Focus analysis on a binding site within 5 Å of a ligand
- Extract a water shell around a macromolecule
Using a simple interface and standard expression syntax, the Atoms Selector acts like a filter for atoms based on your conditions.
How it works
The Atoms Selector Extension supports the same variables and mathematical operations as the more advanced Simple Script extension, but it’s designed to be simpler: just enter a statement that evaluates to true for the atoms you want. For example, to select all atoms within a circle of radius 10 Å centered at (15,15):
|
1 |
((a.x-15)^2 + (a.y-15)^2) < 100 |
This selects atoms in a 2D circular region when the z-coordinate is ignored. You can apply similar logic for distances around specific points in 3D by including a.z in the equation.

Additionally, the Atoms Selector supports a special keyword:
all— Selects all atoms in the current document.
The expression parser understands logical operators like and, or, and not, as well as math functions like abs, sqrt, sin, cos, log, and more. This makes the selection language expressive enough for most tasks without requiring looping or more advanced programming constructs.
Practical Examples
- Select all oxygen atoms:
a.symbol=='O' - Select atoms in the upper-right quadrant:
a.x>0 and a.y>0 - Select atoms around z = 0 plane:
abs(a.z) < 5
Once selected, the atoms can be saved to a new document, visualized differently, or used as input to further simulations or analyses. This saves time and ensures consistency in workflows.
When to use Atoms Selector vs Simple Script
Use Atoms Selector when your goal is just to select atoms according to a condition. It’s quick and avoids writing a full script. Choose Simple Script if you want to modify properties (e.g., shift positions, change types, hide atoms) or use control structures like loops and conditionals.
To try it out, install the Atoms Selector Extension from SAMSON Connect and explore the options in the GUI. No scripting required.
To learn more, including all variables and functions you can use in expressions, check the full documentation here: SAMSON: 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.
