When analyzing or simulating molecular systems, it’s often helpful to focus on a specific part of the structure. Whether you are calculating partial charges, analyzing solvent distribution, or preparing a local environment for docking or QM calculations, selecting atoms in a defined 3D region is a common and repeating task. Thankfully, the Node Specification Language (NSL) in SAMSON provides a concise and powerful way to do that.
Why search atoms by coordinates?
Working at atomic resolution often means focusing on what’s relevant. For example, you might want to:
- Select atoms within a simulation box
- Analyze only atoms within a certain radius of a binding site
- Remove stray water molecules outside a region of interest
- Prepare structural alignments using atoms only in a defined slab
In each of these cases, specifying spatial dimensions is more reliable and reproducible than manual selections. Enter a.x, a.y, and a.z from NSL!
How it works
In SAMSON, every atom has x, y, and z coordinates that you can match using NSL expressions. The syntax allows for ranges, comparisons, and logical conditions. Here are some practical examples:
Example 1: Select atoms within a cube
|
1 |
a.x -10A:10A and a.y -10A:10A and a.z -10A:10A |
This captures all atoms within a 20 angstrom cube centered at the origin.
Example 2: Select atoms above a plane
|
1 |
a.z > 5nm |
A quick way to get everything above a given cutoff, useful in surface interactions or membrane studies.
Example 3: Atoms in a cylindrical volume?
While NSL doesn’t provide a direct way to define a cylinder, you can combine x and y ranges to approximate circular symmetry:
|
1 |
a.x -5A:5A and a.y -5A:5A and a.z 0A:10A |
This roughly identifies atoms in a vertical cylinder of 10 Å height and ~10 Å diameter.
Tips for Better Selections
- Units: Support includes nm, Å, pm, etc. So
a.x 0A:100Ais just as valid asa.x 0nm:10nm. - Combined Filters: Want only oxygen atoms in a region? Use:
a.s O and a.x 0A:10A - Coordinate Checks: Coordinates are in the current reference frame—make sure your structure is aligned as needed.
Bonus: NSL queries can be saved and reused, making it ideal for consistent selections across projects.
To learn more about positional selection and other atom attributes in NSL, visit the official SAMSON documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
