Quickly Select Atoms Using Expressions in SAMSON

One of the most time-consuming tasks in molecular modeling is selecting specific atoms according to their properties. Whether you’re preparing a simulation, cleaning up a structure, or visualizing a region of interest, selecting the right atoms quickly and precisely is essential.

The Atoms Selector Extension in SAMSON provides a powerful solution to this challenge. With a simple expression, you can select atoms based on their positions, elements, charges, visibility, and more—no manual clicking necessary.

Why this matters

Let’s say you want to isolate only atoms that are within a specific radial distance from a point—for example, to cut out a nanotube or nanodisk from a crystal lattice. Or maybe you want to select all carbon atoms with partial charges above a certain threshold. Doing this manually would be tedious and error-prone.

With the Atoms Selector Extension, you define your criteria in a short expression, and the extension takes care of the rest. The selection updates in real-time, saving you time and reducing mistakes.

Using the Atoms Selector

Here’s what a simple selector expression looks like:

This expression selects all atoms within a cylinder of radius 10 Å centered at (15 Å, 15 Å) in the XY-plane. It uses atomic x and y coordinates and basic mathematical operators.

You can make use of a wide range of variables, including:

  • a.x, a.y, a.z: atom positions
  • a.e: element name (e.g., 'Carbon')
  • a.s: element symbol (e.g., 'H')
  • a.pc: partial charge
  • a.sf: serial number

And you can use standard logical and mathematical operations, including and, or, not, >, <, ==, ^ (power), abs(), and many more.

Here’s an example that selects atoms with x > 10 Å and that are carbon atoms:

And a more advanced example checking for atoms with partial charges above 0.2:

Visual Feedback and Flexibility

As soon as you enter your expression, SAMSON highlights matching atoms in the viewport, giving you immediate visual feedback. This makes it easy to adjust parameters on the fly and narrow down your selection quickly.

Looking to select everything? Use the special keyword:

Visual example: cutting from a crystal

Here’s a real example from the documentation: cutting a circular cylinder out of a quartz crystal. The following selection expression accomplishes it:

Cut cylinder out of quartz crystal

This highlights the power of the Atoms Selector Extension – quick, flexible atom selection with just a few characters of code.

Getting started

To use this feature, install the Atoms Selector Extension from SAMSON Connect. You can then access it within the SAMSON interface and start typing conditions immediately.

To learn more and explore additional capabilities, visit the original documentation page: 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.

Comments are closed.