When working with molecular systems, one of the most common and repetitive tasks is identifying and selecting atoms of interest. Whether it’s isolating a solvent, highlighting specific residues in a protein, or selecting atoms based on spatial boundaries, this task can become tedious using purely manual methods.
The Atoms Selector Extension in SAMSON offers an expressive, scriptable approach to selection using mathematical expressions, helping you automate and accelerate this common process.
What It Solves
Manually selecting atoms in a large molecular system can be error-prone and time-consuming, especially when the selection criteria are based on positions, types, or combinations of attributes. Using expressions brings:
- Precision: Define the exact selection via variables like coordinates, element types, and charges.
- Efficiency: Apply your criteria across all atoms in one step.
- Replicability: Easily reuse your expressions in future projects.
How It Works
The Atoms Selector Extension lets you define an expression that is parsed and evaluated for each atom in the active document. If the expression evaluates to true, the atom is selected. Syntax closely follows the scripting language used in the Simple Script Extension, and the same variables can be used.
For instance, you can select all atoms within a cylinder with radius 10Å centered at (15, 15) in the XY-plane using the expression:
|
1 |
((a.x - 15)^2 + (a.y - 15)^2) < 100 |

What You Can Use
You can harness a variety of atom variables including:
a.x,a.y,a.z: Cartesian coordinates of the atoma.elementora.symbol: name or symbol of the element (e.g.,'Carbon','H')a.partialCharge,a.formalCharge: charges on atomsa.chainID,a.residueSequenceNumber: useful for biomolecules
Examples
Select all carbon atoms:
|
1 |
a.element == 'Carbon' |
Select all atoms with x coordinate greater than zero:
|
1 |
a.x > 0 |
Select water molecules:
|
1 |
a.water == 1 |
Select atoms with partial charge less than −0.3:
|
1 |
a.partialCharge < -0.3 |
Select all atoms:
|
1 |
all |
When to Use It
The Atoms Selector is ideal when you are preparing a selection for further structure editing, visualization focus, or scripting with other extensions. It complements manual selection tools by allowing rule-based selection that adapts easily across datasets and projects.
Where to Find It
The Atoms Selector Extension can be downloaded from SAMSON Connect: Atoms Selector Extension.
To learn more or try more advanced use cases, such as combining logic and trigonometric functions, 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.
