Finding the atoms you need in a molecular structure can be surprisingly tedious. A selection based only on element may be too broad: oxygen atoms, for example, can play different roles depending on their bonding, residue, and position in the structure. Repeating manual clicks is slow—and makes it harder to apply the same criteria consistently.
SAMSON’s Node Specification Language (NSL) lets you describe a selection with atom attributes, then combine those criteria into a readable expression. The examples below focus on a practical idea: start with a chemical role, add context, and use structural attributes to narrow the result.
Start with the chemical feature
For a first pass at finding hydrogen-bonding atoms, use the donor and acceptor attributes:
a.hbamatches hydrogen-bond acceptors.a.hbdmatches hydrogen-bond donors.a.hpmatches polar hydrogens.
These attributes are more informative than selecting every nitrogen or oxygen. They identify atoms by the role represented by the corresponding attribute, rather than by element alone. If you want to inspect oxygen acceptors, combine the element symbol with the acceptor flag:
a.s O and a.hba
This reads as “oxygen atoms that are hydrogen-bond acceptors.” Combining conditions can make a selection easier to interpret and reuse than a long series of manual picks.
Add molecular context
A chemically relevant atom may still appear in many parts of a model. Add residue or chain information when you need to focus the selection. For example, a.resi 42 selects atoms in residue 42, while a.c A selects atoms from chain A. Together with an atom feature, these let you express a more focused question:
a.hba and a.resi 42
This combines the acceptor criterion with residue sequence number 42. For multiple residue numbers, the documented syntax supports lists and ranges, such as a.resi 40:50,100. Chain identifiers can likewise be specified as a value or a list, for example a.c B, C.
Backbone attributes can help separate structural regions from other atoms. a.aabb matches heavy atoms belonging to an amino-acid backbone, and a.nabb matches heavy atoms belonging to a nucleic-acid backbone. These attributes are useful when the question is about a backbone rather than every atom in a residue.
Use bonding and ring information to refine a selection
When element identity is not enough, bonded-atom counts offer another way to describe local context. For example, a.nba > 2 selects atoms with more than two bonded atoms, and a.nbo 2 selects atoms with exactly two bonded oxygen atoms. These criteria can help narrow a search by connectivity, provided the relevant bonding information is present in the model.
Ring-related attributes can distinguish atoms in cyclic structures. a.inRing matches atoms in rings. To specify a ring size, use a.ringSize 5,6 for atoms whose reported ring size is five or six. The documentation notes that when an atom belongs to rings of different sizes, the smallest ring size is returned. Keeping that detail in mind can prevent surprises when interpreting a selection.
Check prerequisites before relying on calculated properties
Some attributes require information to be assigned or computed first. Geometry, selected with a.g, needs to be computed; hybridization, selected with a.hy, needs to be assigned and may not be specified by default. For example, a.g tet selects atoms with tetrahedral geometry, while a.hy sp2 selects atoms with SP2 hybridization. If such a query returns fewer atoms than expected, check whether the required property is available in the model.
A simple selection strategy
- Choose the property that answers your question: element, donor/acceptor role, backbone membership, or ring status.
- Add context: chain, residue number, or bonding criteria.
- Verify prerequisites: computed geometry and assigned hybridization are not automatic assumptions.
- Keep the expression readable: combine a small number of criteria, then refine only if needed.
This approach turns atom selection into a description of what you are looking for—not just a collection of clicks. For the complete attribute reference and additional examples, see the SAMSON atom attributes documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
