Find the segment that fits: practical NSL filters for molecular models

Large molecular models can be hard to inspect one segment at a time. When you need to locate a long chain, a small group, or a segment with a particular elemental composition, Node Specification Language (NSL) lets you describe the property you want and match segments by it.

This is useful when visual inspection is not enough: a model may contain many segments, and names alone may not tell you which one has the size or composition you need. The segment attribute space gives you filters for residue and structural-group counts, atom counts, elemental counts, charge, and basic node states.

Start with the segment prefix

Segment attributes are in the segment attribute space, whose short name is s. A query such as s.nr > 100 matches segments with more than 100 residues. The long form, segment.numberOfResidues > 100, expresses the same criterion. Short names make queries compact; long names can make them easier to read when you are learning the language or revisiting a query later.

For residue counts, the documentation gives both comparisons and ranges:

  • s.nr > 130 matches segments with more than 130 residues.
  • s.nr 100:130 matches segments with a residue count between 100 and 130.

Ranges are also available for structural-group counts. For example, s.nsg 10:12 matches segments with between 10 and 12 structural groups. These filters help turn a vague search—“the larger segment” or “the segment with roughly this many groups”—into a checkable criterion.

Use composition and charge to narrow the search

Segments inherit several attributes from the structuralGroup attribute space. These include total atom count (s.nat), counts of carbon, hydrogen, nitrogen, oxygen, and sulfur atoms (s.nC, s.nH, s.nN, s.nO, s.nS), coarse-grained atom count (s.ncga), formal charge (s.fc), and partial charge (s.pc).

For example, s.nC 10:20 matches segments with 10–20 carbon atoms, while s.nat < 1000 selects segments with fewer than 1,000 atoms. To check a charge criterion, use an integer comparison such as s.fc > 1, or a floating-point range such as s.pc 1.5:2.0. Choose the attribute that corresponds to the question you are asking: an atom count, an elemental count, and a charge are different properties, even when they are being used to narrow the same search.

Keep the scope in mind

These queries match segments, not individual atoms or residues. That distinction matters when interpreting a result: s.nH < 10 concerns the number of hydrogen atoms in a segment, whereas s.nr > 100 concerns the number of residues in that segment.

Some available attributes describe node state rather than molecular composition. For example, s.h checks whether a segment is hidden, s.v checks whether it is visible, and s.n "A" matches a segment by name. Boolean attributes can also be negated, as in not s.v. The name attribute accepts quoted strings; the documentation includes examples such as s.n "L*".

A practical way to begin is to choose one property that separates the segments you care about, test that filter, then adjust the threshold or range if needed. Once the result is understandable, keep the expression with your analysis notes so you can reuse the same criterion. For the complete attribute list and additional details, see the SAMSON segment attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.