A molecular structure can contain many bonds that look similar at a glance. When you need to find a particular subset—perhaps bonds within a distance range, bonds of a certain order, or bonds marked with a specific type—visual inspection can become slow and inconsistent. SAMSON’s Node Specification Language (NSL) lets you describe bond criteria directly, so you can search by measurable attributes instead of relying on appearance alone.
This guide focuses on a practical question: which bond attribute should you use? In NSL, the bond attribute space is b. You can write the full attribute name, such as bond.length, or use its shorter form, such as b.len. The short forms are handy when writing repeated searches.
Start with the property you actually need
Three attributes can sound similar but describe different things:
- Length is a floating-point measurement of the distance between the bonded atoms. Use
bond.lengthorb.lenwhen the criterion is geometric. - Order is a floating-point bond-order value. Use
bond.orderorb.owhen you want to filter by numerical order. - Type is a named category, such as single, double, aromatic, or amide. Use
bond.typeorb.twhen the category is what matters.
Choosing the right attribute helps avoid a common source of confusion: a bond’s length is not its order, and a named type is not the same kind of value as a numeric order.
Use ranges to narrow down bond lengths
A range is useful when you want to find bonds within a window rather than above or below one cutoff. For example, this expression matches bonds between 1.2 and 1.4 angstroms:
b.len 1.2A:1.4A
The same distance can be expressed in nanometers. Since 1 nm equals 10 angstroms, the example above corresponds to 0.12–0.14 nm:
b.len 0.12nm:0.14nm
Keeping units explicit makes a search easier to review and helps prevent a factor-of-ten mistake when comparing values written in different units. The documentation also shows a one-sided criterion, b.len >= 1.5A, for matching bonds at or above a specified length.
Choose between numeric order and named type
For a numeric order threshold, use an expression such as b.o >= 2. To search across a range, use b.o 1.5:3. These are useful when the desired condition is expressed numerically.
If your question is categorical—“find single bonds” or “find aromatic bonds”—use the type attribute instead. For example, b.t s matches single bonds, while b.t ar matches aromatic bonds. The documented aliases include s or 1 for single, d or 2 for double, and t or 3 for triple. Other available categories include amide (am), dummy (du), and undefined (un).
You can list multiple types in one expression: b.t s, d matches single and double bonds. One important caveat: the documentation notes that a bond must have its bond type defined for a type query to be useful. If a search does not return the bonds you expect, check whether the relevant bond types are defined.
Use custom types only when that is the data you need
bond.customType, abbreviated b.ct, matches bonds by integer custom-type values. For example, b.ct 0 selects bonds with custom type 0, and b.ct 0:2 selects values between 0 and 2. A custom-type number is an identifier to filter on; the attribute reference does not assign it a universal chemical meaning. Use it when your structure or workflow uses those custom labels, not as a substitute for the documented bond type or order.
A simple way to build a reliable bond search is to translate your question into one property at a time: distance, numerical order, named type, or custom type. Then check the units and value format before running the expression. This makes the search easier to understand and reproduce.
For the complete bond attribute reference and additional examples, see the SAMSON bond NSL documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
