A common molecular-modeling frustration: you know what you want to inspect—perhaps atoms near a ligand—but a search returns more than expected. A distance query can match not only individual atoms, but also larger nodes that contain nearby atoms. The result may look like the whole document or a parent structure has been selected, when your goal was a precise set of atoms.
SAMSON’s Node Specification Language (NSL) lets you state both what kind of node to find and how it relates spatially to another set. That distinction is the key to making proximity searches useful and predictable.
Start with the node type
Consider the query * within 5A of "GLN 2". The asterisk does not restrict the result to atoms. Since a larger node can contain atoms that are within 5 angstroms of GLN 2, that parent node may also match. If you want atom nodes, say so explicitly:
node.type atom within 5A of "GLN 2"
The short form is n.t a w 5A of "GLN 2". Both versions ask for atoms within 5 angstroms of the named node. Choosing the node type up front helps prevent a valid-but-surprising result from getting in the way of the analysis.
Include nearby atoms—or exclude the reference group
The atom-only query still includes atoms that belong to GLN 2 if they meet the distance condition. That may be exactly what you want when examining the residue itself and its surroundings. If your goal is to find nearby atoms outside GLN 2, add an out of condition:
node.type atom within 5A of "GLN 2" out of "GLN 2"
This expresses three useful constraints in one query: return atoms, keep those within 5 angstroms of the named group, and remove atoms that belong to that group. It is a practical pattern for inspecting a local environment without the reference atoms crowding the result.

Use the same logic for other selections
Proximity queries are not limited to a residue. The target can be any selection expression. For example, node.type residue beyond 5A of node.selected finds residue nodes beyond 5 angstroms of the current selection. The short form is n.t r b 5A of n.s. This can help identify residues outside a chosen neighborhood.
You can also define the first set by an element or a name. For example, "CA" within 5A of S searches for nodes named CA within 5 angstroms of sulfur atoms. Quotes matter for names: they make clear that CA is a node name, and quoted names can contain spaces, as in "GLN 2".
Distance values can use units such as A for angstroms and nm for nanometers. Keeping the unit visible in the expression makes a query easier to read and review later.
Where to enter a query
Use Select > Find to make a search-driven selection in the active document. In the search box, press Tab for context-sensitive completion—for example, to explore nodes whose names begin with a partial name. You can also enter an NSL expression in the Document view’s filter box, then press Enter to select matching nodes.

A quick troubleshooting checklist
- Too many kinds of nodes? Add a type constraint such as
node.type atomornode.type residue. - The reference group appears in the result? Add
out offollowed by that group. - A name with spaces is not matching? Put the full name in quotes, for example
"GLN 2". - Need a different neighborhood size? Adjust the distance and specify its unit, such as
3Aor0.5nm.
These small refinements turn a broad proximity search into a deliberate selection: choose the node class, define the distance relationship, and exclude the reference set only when needed. For the full syntax and more examples, see the SAMSON Node Specification Language documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
