When modeling molecular systems at the atomic level, selecting specific atoms based on quantitative criteria is often necessary—but rarely straightforward. Whether you need to isolate water molecules, highlight carbon atoms, or extract a structure within a geometric region, doing it manually can be time-consuming and prone to error. Fortunately, SAMSON offers a solution: the Atoms Selector Extension.
This extension allows you to use precise mathematical expressions to select atoms in your active document. If you’re working with molecular crystals, nanoparticle shapes, or want to emphasize certain molecular regions, this tool can save you considerable effort and make your modeling workflow more reproducible.
Why Mathematical Selection Matters
Let’s say you’re analyzing a quartz crystal and want to extract a cylindrical portion for simulation. Manually clicking through thousands of atoms is inefficient and often inaccurate. Instead, you can apply a single-line expression to select just the atoms you need. For example, this expression selects atoms within a cylinder of radius 10 Å centered at (15, 15):
|
1 |
((a.x - 15)^2 + (a.y - 15)^2) < 100 |
This method is not only fast—it also minimizes errors and makes it easy to reproduce your selection criteria in future projects.
How It Works
Under the hood, the Atoms Selector Extension uses the same variables and logical/mathematical constructs as the Simple Script Extension. This includes variables such as:
a.x,a.y,a.z: atom positionsa.element,a.symbol: element names and symbolsa.chainID,a.residueSequenceNumber: structural hierarchy data
And a wide range of operators and functions such as abs, sin, sqrt, and, or, and more.
Examples You Might Find Useful
Here are a few selection examples that demonstrate the flexibility of this approach:
Selecting All Water Molecules
|
1 |
a.water == 1 |
Selecting Carbon and Hydrogen Atoms
|
1 |
(a.element == 'Carbon') or (a.symbol == 'H') |
Selecting Atoms in the Positive X-Y Quadrant
|
1 |
(a.x > 0) and (a.y > 0) |
Creating a Graphene Tile
Crafting hexagonal or rectangular nano-tiles from a graphene sheet is easily achieved by combining spatial constraints:
|
1 |
(abs(a.x) < 10) and (abs(a.y) < 10) |
You can then use this tile as a repeating unit or apply transformations for more complex shapes using script-based manipulations.
Visual Example: Quartz Crystal Selection
The image below shows the result of selecting a cylindrical shape from a quartz crystal using the expression shown earlier:

When to Use the Atoms Selector vs. Simple Script
The Atoms Selector is ideal for selection tasks, especially when you’re not modifying properties like coordinates or element types. For more advanced tasks—such as rotating atoms, generating geometric deformations, or scripting procedural filters—consider the Simple Script Extension.
To explore more use cases and see scripted examples, visit the full SAMSON documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
