Identifying and working with specific bond types can be a routine but time-consuming task for molecular modelers. Whether you’re validating a structure, preparing a molecule for simulation, or analyzing chemical behavior, being able to quickly select bonds like single, double, or aromatic bonds is essential.
This is where the Node Specification Language (NSL) in SAMSON offers a very practical solution. The NSL allows you to specify certain atoms, bonds, and more using a compact syntax. In this post, we’ll take a focused look at how to filter bonds by type using NSL.
Why You Might Need This
You may be refining a molecule’s geometry and only want to calculate lengths of single bonds. Or maybe you’re doing a transformation that only applies to aromatic bonds. Without a filtering tool, this could mean lots of manual work. NSL helps you perform such selections quickly and reproducibly.
Using bond.type in NSL
The bond.type attribute in NSL lets you select bonds based on their type. Bonds can be:
- single (
s,1) - double (
d,2) - triple (
t,3) - amide (
am) - aromatic (
ar) - dummy (
du) - undefined (
un)
Let’s say you want to select all aromatic bonds. Just use:
|
1 |
b.t ar |
Want to combine multiple types? No problem:
|
1 |
b.t s,d |
This matches all single and double bonds. You may also use the longer version for better readability:
|
1 |
bond.type single, double |
The syntax is quite readable and useful when scripting or building reusable queries. This is especially handy in large structures or when using pipeline operators in the SAMSON visual model editor.
Caveats to Keep in Mind
Note that not all imported structures come with bond types assigned. If the bond type is undefined, make sure to define them using SAMSON’s bond perception features before running filters.
Practical Examples
- To select only triple bonds:
b.t t - Select all dummy or undefined bonds (useful for cleaning up imported structures):
b.t du,un - Mixing numeric and letter-based short codes works too:
b.t 1,2matches single and double bonds
This filter can then be combined with others (like bond length or order) for even more powerful selections. For instance, to find all double or triple bonds longer than 1.3Å:
|
1 |
b.t d,t & b.len > 1.3A |
In summary, using NSL’s bond.type attribute can make a huge difference in how efficiently you analyze or modify molecular structures in SAMSON.
To learn more about selecting bonds based on bond type, see the full documentation at https://documentation.samson-connect.net/users/latest/nsl/bond/.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download them at https://www.samson-connect.net.
