From a crowded structure to the atoms you need

A molecular structure can contain thousands of atoms, and a useful selection is rarely just “all the oxygens” or “everything in this chain.” You may need a specific element, in a particular region, with a particular chemical or structural property. Building that selection by clicking atoms one at a time is tedious—and makes it harder to repeat the same analysis later.

SAMSON’s Node Specification Language (NSL) lets you describe the atoms you want using attributes and combine criteria into a single expression. The atom attribute space uses the prefix a; for example, a.s O selects oxygen atoms by element symbol. You can combine conditions with and to narrow the result.

Start broad, then add constraints

A useful way to construct a query is to begin with a recognizable group and add one filter at a time. For example, a.s O and a.w matches oxygen atoms with the water flag. If you want oxygen or nitrogen, use a list: a.s O, N. Lists are also useful for residue sequence numbers, as in a.resi 40:50,100, which includes residues in the 40–50 range and residue 100.

This approach helps avoid an easy source of confusion: an element is not the same thing as a role. An oxygen atom might be part of water, a protein, or another molecule. The water attribute can refine an element selection, while hydrogenBondAcceptor identifies atoms marked as hydrogen-bond acceptors. For example, a.s O and a.hba asks for oxygen atoms that also match the acceptor attribute. The combined expression is more specific than selecting every oxygen.

Use structure labels to keep selections local

When a model contains multiple chains or distant regions, chain and residue attributes can make an expression much more targeted. To select atoms from chain A, use a.c A. To select atoms associated with residue sequence numbers 40 through 50, use a.resi 40:50. These filters can be combined with an element or other property—for example, a.c A and a.resi 40:50 and a.s O describes oxygen atoms in that chain and residue range.

NSL also provides a.ci for chain IDs, which are integer values. Chain names and chain IDs are distinct attributes, so use the one that matches the information available in your structure. If a query returns an unexpected result, checking which attribute represents the identifier you intended is a good first troubleshooting step.

Filter by coordinates or chemical properties

For a spatially bounded selection, coordinate attributes accept length units and ranges. For example, a.x 1nm:10nm selects atoms whose x coordinate lies between 1 and 10 nanometers. You can combine coordinate conditions, such as a.x > 10 A and a.y > 10 A. These are coordinate filters: they describe positions along the x, y, or z axis, rather than a distance from another atom.

Other attributes let you express chemical distinctions without relying on element alone. a.ar matches aromatic atoms, and a.fc can filter by formal charge, such as a.fc -1, 1. Bonding counts are available too: a.nbo 2 matches atoms with two bonded oxygen atoms, while a.nbha 3 matches atoms with three bonded heavy atoms. Combining these filters can help isolate a meaningful subset while keeping the selection rule readable.

Check prerequisites and build queries incrementally

Some attributes depend on information being present or computed. Coarse-grained mass and radius apply to coarse-grained atoms; hybridization may need to be assigned; and geometry needs to be computed first. A query using one of these properties may not behave as expected if the relevant data is unavailable. When troubleshooting, test the simplest condition first—such as a.hy sp2—then add other filters once you know the attribute is populated.

Ranges, comparisons, and comma-separated values make it possible to keep many selections compact. But readability matters: add one condition at a time, verify the resulting selection, and retain the final expression so you can reuse or adjust it. For the complete attribute list and additional examples, see the SAMSON atom attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.