When a molecular structure contains thousands of atoms, a selection such as “all oxygens” is often too broad. The atoms you actually need may be only those in a particular chain, residue range, ring, or region of space. SAMSON’s Node Specification Language (NSL) lets you combine atom attributes to describe that selection directly, instead of relying on a series of manual picks.
This guide focuses on a practical subset of the atom attributes: element and chemical-role filters, residue and chain identifiers, ring membership, and coordinates. The examples use the short a. prefix for the atom attribute space. Atom attributes match atom nodes, so these expressions are intended to describe atoms—not arbitrary nodes in the molecular document.
Start with chemistry, then add context
An element filter is a useful first step. For example, a.s O matches oxygen atoms, while a.e Nitrogen, Oxygen matches atoms whose element is nitrogen or oxygen. The comma-separated values give you alternatives within that attribute. To narrow the result to aromatic carbon atoms, combine two conditions: a.s C and a.ar.
This “start broad, then narrow” pattern helps keep queries readable. A hydrogen-bond feature can be added in the same way: a.s O and a.hba asks for oxygen atoms marked as hydrogen-bond acceptors. For donor atoms, a.s N and a.hbd combines nitrogen with the donor attribute. These attributes describe the available flags; they do not replace checking whether the structure has the chemical information your analysis requires.
Use chain and residue numbers to target a region
When a structure has multiple chains or a long sequence, location in the biological structure is often more useful than element alone. For example, a.c A and a.resi 40:50 narrows the query to atoms in chain A and residues 40 through 50. You can use a list of residue numbers as well: a.resi 40, 42, 50. The chain attribute accepts character values, while residue sequence numbers are integers.
Chain and residue filters are especially helpful when a chemical feature appears more than once. Instead of collecting every oxygen atom in the model, you can ask for oxygens in a specific sequence interval: a.s O and a.c A and a.resi 40:50. Read the expression from left to right as a set of constraints: element, chain, then residue range.
Find ring atoms and particular geometries
For ring-focused inspection, use a.inRing to match atoms that are in rings. To specify ring size, try a.ringSize 5,6 for atoms in five- or six-membered rings. The documentation notes that when an atom belongs to rings of different sizes, the ring-size attribute returns the smaller ring size. Keep that detail in mind when interpreting fused or connected ring systems.
Geometry and hybridization can add another layer, but they depend on computed or assigned information. For instance, a.g tet matches atoms with tetrahedral geometry, and a.hy sp2 matches atoms with SP2 hybridization. Geometry needs to be computed first; hybridization may need to be assigned and may not be present by default. If a query returns fewer atoms than expected, check whether the relevant property exists in the structure before assuming the chemistry itself is absent.
Use coordinates for a spatial crop
Coordinates are useful when the area of interest is defined by position rather than residue identity. A query such as a.x 0A:10A and a.y 0A:10A restricts atoms to ranges along both the x and y axes. Add a z range to describe a box in three dimensions, for example a.x 0A:10A and a.y 0A:10A and a.z 0A:10A. NSL supports length units such as angstroms and nanometers, so use units consistently and choose bounds that make sense for the model’s coordinate frame.
A simple debugging habit
Build a complex query one condition at a time. Start with an element or other broad attribute, then add a chain, residue interval, chemical flag, or coordinate bound. If the result becomes unexpectedly empty, remove the last condition and check whether that attribute is available or whether its value is spelled as expected. This small habit makes it easier to tell the difference between a genuinely empty selection and a query that is too restrictive.
For the full list of atom attributes, short names, value types, and examples, see the SAMSON atom attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
