Find the Molecular Groups You Need Without Counting Atoms by Hand

When a molecular scene contains many structural groups, finding the ones with a particular size, elemental composition, or charge can become a tedious visual search. Node Specification Language (NSL) offers a more direct approach: describe the property you care about, and use an attribute expression to match structural groups with that property.

This is especially useful when you are narrowing down a scene by composition—for example, looking for small carbon-containing groups, groups with a specified charge, or structures with a particular ID. The expressions below are drawn from SAMSON’s structural-group attribute space, whose short prefix is sg.

Start with size and composition

To find groups by atom count, use sg.nat. For instance, sg.nat < 1000 matches groups with fewer than 1,000 atoms, while sg.nat 100:200 matches groups with a count between 100 and 200.

When total size is not specific enough, filter by the number of atoms of a particular element:

  • sg.nC < 10 looks for groups with fewer than 10 carbon atoms.
  • sg.nH 10:20 looks for groups with 10 to 20 hydrogen atoms.
  • sg.nN < 10 checks the number of nitrogen atoms.
  • sg.nO 10:20 checks the number of oxygen atoms.
  • sg.nS < 10 checks the number of sulfur atoms.

There is also sg.ncga for the number of coarse-grained atoms. These separate counts help answer a practical question: is a group large because it contains many atoms overall, or because it has a particular elemental makeup?

Check charge without inspecting every group

Structural groups have attributes for both formal and partial charge. Use sg.fc for formal charge and sg.pc for partial charge. For example, sg.fc > 1 matches groups with formal charge greater than 1, and sg.pc 1.5:2.0 matches groups with a partial charge between 1.5 and 2.0.

The distinction matters: these are different attributes, so choose the one that corresponds to the charge information you want to examine. Formal charge accepts integer values; partial charge accepts real values.

Use IDs and names when composition is not the clue

If you already know a structure ID, sg.id can match it directly, compare it with a threshold, or specify multiple ranges. For example, sg.id 5:10, 25:30 matches IDs in either of the two listed ranges. This can be handy when returning to known parts of a structure rather than searching by chemistry.

Structural groups also inherit node attributes. You can match by name with an expression such as sg.n "A", or check visibility and selection state with expressions such as sg.v, not sg.v, and sg.selected. The structural-group form of selected has no short name, so use its full name.

A simple way to make the search useful

Begin with the property that best describes the group you are trying to find: atom count for size, an element count for composition, charge for electrostatic character, or ID/name for identification. Use a threshold when you have a cutoff, and a range when you have a bounded interval. Then refine your expression based on what the matches tell you. This turns an open-ended visual scan into a series of specific, readable checks.

These attributes match structural group nodes; they are not a general-purpose description of every node type. For the full attribute list and additional examples, see the SAMSON structural group attributes reference.

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

Comments are closed.