Manually selecting atoms in a molecular model is easy to get wrong. A few missed atoms can change what you inspect, measure, or prepare next—and repeating the same selection later can be tedious. SAMSON’s Node Specification Language (NSL) lets you describe the atoms you want using chemical, structural, and spatial properties. The result is a selection you can read, adjust, and reuse.
This guide builds a practical selection workflow from the atom attributes in the reference. The examples use the compact a. prefix for the atom attribute space. You can also write the full form, such as atom.symbol O. Atom attributes match atom nodes, so they are suitable when the target is a set of atoms rather than a broader node type.
Start with a broad, understandable filter
Begin with a property that describes the atoms you are looking for. To identify oxygen and nitrogen atoms, use:
|
1 |
a.s O, N |
The symbol attribute accepts element symbols, and a comma-separated list matches either listed value. The longer equivalent is atom.symbol O, N. You can use element names instead, for example a.e Oxygen, Nitrogen. Symbols are often quicker to scan; element names can be clearer when sharing a query with someone unfamiliar with the notation.
Next, narrow the selection with another condition. For example, to find oxygen or nitrogen atoms marked as hydrogen-bond acceptors:
|
1 |
a.s O, N and a.hba |
Here, and combines the element filter with the hydrogen-bond-acceptor property. The same pattern works with other attributes: first state what kind of atom you want, then add the structural or chemical condition that matters.
Limit the search to a chain or residue range
When a structure contains several chains or a long sequence, add a location filter before interpreting the result. To restrict a selection to chain A and residues 40 through 50, for example, combine the chain and residue-sequence attributes:
|
1 |
a.c A and a.resi 40:50 |
Add a.heavy if you want to exclude hydrogen atoms:
|
1 |
a.c A and a.resi 40:50 and a.heavy |
The heavy attribute means non-hydrogen atoms. This is useful for focusing on the main molecular framework, but remember that it will also remove hydrogens that may matter for a particular interaction analysis. For alternate atom locations, a.alt A or a.alt B, C can specify which location labels to include.
Use ranges to express numeric criteria
Many atom attributes accept comparisons and ranges. For instance, a.fc < 0 describes atoms with negative formal charge, while a.oc 0.6:0.7 selects atoms with occupancy between 0.6 and 0.7. A range such as a.resi 40:50 includes residue sequence numbers from 40 to 50. Use these filters to make the criterion explicit instead of selecting by eye.
Coordinates can also narrow a selection to a region of space. For example, a.x 1nm:10nm matches atoms whose x coordinate lies in that interval. Units matter: the reference gives examples using angstroms, nanometers, and picometers. Including a unit in a query makes the intended scale easier to recognize.
Check whether the property is available
Some filters depend on information that may need to be computed or assigned first. The documentation notes that atom geometry must be computed before using a query such as a.g tet for tetrahedral geometry. Hybridization may also need to be assigned; for example, a.hy sp2 matches atoms with SP2 hybridization. If such a query returns no atoms, check the required property before assuming the structure contains no matches.
Other attributes apply only in particular contexts. Coarse-grained mass and radius filters work for coarse-grained atoms, and coarse-grained type requires a defined type. Being aware of these conditions can save time when a syntactically valid selection does not produce the expected result.
Make selections easier to trust
A useful habit is to build a query in stages: start with an element or structural group, add one condition at a time, and inspect the resulting selection. This makes it easier to spot an overly restrictive condition or a missing piece of metadata. Keep the final expression with your analysis notes so that the selection can be understood and recreated later.
For the complete attribute list, syntax examples, and details for each atom property, see the SAMSON atom attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
