How to Select Atoms with Precision in SAMSON Using Mathematical Expressions

When working with large molecular structures, molecular modelers often face the challenge of isolating specific atoms for inspection or modification. Manually selecting these atoms can be tedious and error-prone—especially in systems with thousands or millions of atoms like biomolecular complexes, crystals, or nanostructures. If you’ve ever tried to pick atoms in a detailed structure and found yourself zooming, clicking, and hoping, then this feature is for you.

The Atoms Selector Extension in SAMSON addresses this need by allowing precise atom selection using a single mathematical expression. You can now define spatial or chemical criteria in a concise syntax and instantly highlight parts of your model to study, edit, or export.

Why This Matters

Let's say you want to extract all atoms within a spherical or cylindrical region, select atoms of a specific element, or isolate parts of a molecule based on position or charge. This is common when preparing inputs for simulations, creating visualizations, or analyzing local environments. Manually performing such selections is slow and can lead to mistakes, especially when the criteria are non-trivial (e.g., combining geometric and chemical features).

In such cases, the Atoms Selector gives you the flexibility to:

  • Select atoms based on x, y, and z coordinates
  • Combine logical operations: and, or, not
  • Use chemical attributes like element symbol or charge
  • Define spatial filters—spheres, cylinders, planes, etc.

How It Works

After installing the Atoms Selector Extension, you simply provide a mathematical expression to determine which atoms to select. For example:

This selects atoms within a cylinder of radius 10Å centered at (15, 15) in the XY plane. Useful for isolating a region in a crystal or a layered material.

Here’s another example — to select all carbon atoms with a positive partial charge:

And you can always use the special keyword all to select the entire structure.

Visual Example

Below is an example of a cylinder cut out of a quartz crystal, achieved with a single expression:

Cut cylinder out of quartz crystal

Tips for Using Atoms Selector Effectively

  • Use short names like a.e for a.element and a.sf for n.selectionFlag to write more compact expressions.
  • Combine spatial filters with chemical constraints to precisely identify functional regions.
  • You can use trigonometric functions or distance equations to define custom geometries.
  • Expressions are case-insensitive!

Final Thoughts

If you frequently work with complex molecular systems, the Atoms Selector Extension can save significant time and provide better control over how you interact with your models. Next time you’re tempted to manually dig through atoms to find what you need, consider using a precise expression instead.

To learn more, check out the full documentation page here: 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 here.

Comments are closed.