When working in molecular design and visualization, it’s easy to accumulate multiple render presets while experimenting with colors, styles, and representations. But what if you’re revisiting a project weeks later—or collaborating with others—and need to quickly find a specific render preset among many?
This is where Node Specification Language (NSL) in SAMSON becomes invaluable. NSL allows you to precisely query nodes of interest—including render presets—based on their attributes. If you’ve ever struggled to locate a preset named “HydrophobicSurface” or filter out selected presets, the solution might already be at your fingertips.
Understanding the Problem
Molecular modeling projects can get complicated quickly. A model might include dozens of visual styles defined by different render presets. Each one might control how atoms are displayed—whether spheres, ribbons, surfaces, or something more complex.
But not all these presets are relevant at any given time. If you’re trying to troubleshoot a visualization or align it with publication standards, locating the right render preset is crucial—and sometimes a bit like searching for a needle in a haystack.
Using NSL to Filter Render Presets
Render presets in SAMSON can be filtered using attributes from the renderPreset attribute space, also referred to as rp. Let’s look at three useful attributes that you can use to select and filter presets:
rp.n — Name
You can filter presets by name using rp.n. For example:
|
1 |
rp.n "SurfaceRepresentation" |
This selects all render presets with the exact name "SurfaceRepresentation". You can also use wildcard characters:
|
1 |
rp.n "Hydro*" |
This matches render presets whose names begin with "Hydro", such as "HydrophobicSurface" or "HydrogenMap".
rp.selected — Selected Status
This attribute lets you filter presets that are currently selected:
|
1 |
rp.selected |
This will match all selected render presets. Conversely, use the not operator to find presets that are not currently selected:
|
1 |
not rp.selected |
Though selected is inherited from the general node attributes, note that it has no short form in this context—it must be written fully.
rp.sf — Selection Flag
If you’re using selection flags to control programmatic filters or selections, this attribute helps narrow down your list. For example:
|
1 |
rp.sf false |
This returns render presets that do not have the selection flag set. It’s handy if you use the selection flag to track presets under review or in a special state.
Combine Filters for Precision
The real power comes in combining these filters:
|
1 |
rp.n "Hydro*" and rp.sf |
This selects all render presets whose name starts with “Hydro” and have their selection flag set.
Or, to find all unselected render presets that don’t match a naming pattern:
|
1 |
not rp.selected and not rp.n "Default*" |
When and Why This Matters
- If you’re preparing figures for publication, knowing exactly which render presets are applied can save time and avoid inconsistencies.
- When exporting or sharing content, filtering allows you to exclude test presets from your export.
- It keeps your scene organized and helps maintain clarity between presets used for rendering vs. those for intermediate testing.
This kind of search flexibility makes working with molecular designs more manageable, especially in collaborative or iterative work where render presets evolve over time. For more information and examples, go to the render preset attributes documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
