Stop Scanning the Structure: Find Molecular Groups by Size, Composition, and Charge

Large molecular models can be difficult to inspect one group at a time. If you need to find a small fragment, locate groups rich in a particular element, or check which groups carry a certain charge, visual browsing can quickly become tedious. SAMSON’s Node Specification Language (NSL) lets you describe these criteria as queries over structural groups.

Structural-group queries use the sg attribute space. The key idea is to turn a question about a group into a comparison against one of its attributes. For example, to find groups with fewer than 1,000 atoms, use sg.nat < 1000. To look for groups with 100–200 atoms, use sg.nat 100:200. Ranges are a compact way to express size limits when an exact count is not useful.

Use composition to narrow the search

Atom-count attributes make it possible to search by elemental composition without manually counting atoms. The short names are sg.nC for carbon, sg.nH for hydrogen, sg.nN for nitrogen, sg.nO for oxygen, and sg.nS for sulfur. For instance, sg.nO < 10 matches groups with fewer than ten oxygen atoms, while sg.nN 10:20 matches groups with 10 to 20 nitrogen atoms. The same comparison style applies to the other element-count attributes.

This is useful when the first question is broad: “Which groups are relatively small?” or “Where are the groups with many oxygen atoms?” Start with one attribute and a practical range, then adjust the threshold based on the results. This keeps the search criteria easy to read and makes it clear which property is doing the filtering.

Know which kind of charge you mean

Charge searches need one extra bit of care. sg.fc refers to a structural group’s total formal charge, and accepts integer comparisons or ranges. For example, sg.fc 1 matches groups with formal charge equal to 1, and sg.fc 6:8 matches groups with formal charge from 6 to 8.

sg.pc searches by total partial charge instead. Partial charge values can be real numbers, so a range such as sg.pc 1.5:2.0 can be used to find groups whose total partial charge falls between those values. Formal charge and partial charge are different properties; choosing the right one depends on what you want to inspect. These attributes describe the total charge of a structural group, not a charge threshold for each individual atom.

Keep searches readable

NSL offers both full attribute names and short names. For example, structuralGroup.numberOfAtoms 100:200 is the full form of sg.nat 100:200. Short forms are convenient for repeated searches; full names can be easier to understand when sharing a query with someone who is new to NSL.

You can also search by structure ID: sg.id >= 10 selects groups with IDs greater than or equal to 10, while sg.id 5:10, 25:30 specifies two ID ranges. For presentation-related checks, structural groups inherit node attributes such as visibility and selection. For example, sg.v refers to visible groups and not sg.selected refers to groups that are not selected.

A practical approach is to begin with the attribute that best captures your question—size, element count, charge, ID, or display state—and use a clear threshold or range. The structural-group reference lists all available attributes and examples: learn more in the SAMSON documentation.

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

Comments are closed.