When working with large molecular models, quickly finding atoms with certain characteristics can save a significant amount of time and reduce visual clutter. Whether you need to select only aromatic carbons, residues in a specific chain, or atoms with a particular hybridization, SAMSON’s Node Specification Language (NSL) provides a flexible and powerful solution.
This blog post explains how to use the Atom attributes in NSL to filter atoms based on properties like element type, charge, hybridization, and more. These queries can be especially helpful in structural analysis, model preparation for simulations, or generating publication-ready images.
What is NSL?
NSL (Node Specification Language) is a compact language in SAMSON for writing precise queries to select nodes (such as atoms) based on a rich set of attributes. For atom-level queries, NSL uses the a prefix, which stands for the atom attribute space.
Examples of Common Atom Queries
Below are practical examples of how to use NSL to filter atoms with specific characteristics:
๐งช Find aromatic atoms
|
1 |
a.ar |
This matches all atoms marked as aromatic.
๐งฌ Select carbon atoms in chain B
|
1 |
a.s C and a.c B |
This selects carbon atoms that belong to chain B.
โก Match atoms with a partial charge greater than 1.3
|
1 |
a.pc >= 1.3 |
This helps you find potentially reactive sites in the molecule.
๐ Identify atoms in six-membered rings
|
1 |
a.ringSize 6 |
Useful for detecting specific motifs like benzene rings or sugar rings.
๐ง Isolate water oxygen atoms
|
1 |
a.s O and a.w |
This narrows down the view to oxygen atoms that are flagged as water โ helpful when analyzing hydration shells.
Combining Filters
You can combine multiple conditions using logical operators like and, or, and not:
|
1 |
a.e Nitrogen and a.hbd |
This matches nitrogen atoms that act as hydrogen bond donors.
Filtering Based on Bonding
Atom attributes also allow filtering based on the number of bonded atoms of different types. For example:
|
1 |
a.nbh 2 |
This returns atoms bonded with exactly two hydrogens.
Why It Matters
Instead of manually selecting atoms โ which can be challenging in large or complex molecular models โ NSL makes it possible to write a short, precise expression. This not only helps speed up workflows but also enhances reproducibility and accuracy by using clearly defined criteria.
More Visual Exploration
A good strategy for exploring your model is to start with general attributes โ like a.heavy or a.ar โ and layer on more specific constraints. For publication figures or presentations, filtering and coloring based on properties such as a.geometry or a.hy can be particularly helpful.
For a full list of atom attributes and their usage, visit the official NSL atom attributes documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.
