Find the Render Presets You Mean—Without Searching by Guesswork

When a molecular model contains several render presets, finding the right one can become a small but distracting task. A name may be familiar, a preset may be selected, or a selection flag may be set—but those are different attributes to check. SAMSON’s Node Specification Language (NSL) lets you express these checks as compact queries.

The key is to use the renderPreset attribute space, whose short name is rp. It matches only render preset nodes. That scope helps make a query more precise: rather than asking broadly about nodes, you can state that you are looking for render presets and then specify which property matters.

Start with the question you need to answer

Before writing a query, decide what you are trying to find. Are you looking for a preset by name? Checking whether it is selected? Or testing its selection flag? Choosing the relevant attribute first makes the expression easier to read and reduces the chance of treating two different checks as interchangeable.

  • Find by name: use rp.n, the short form of rp.name. Names are written in quotes. The documented examples are rp.n "A" and rp.n "L*".
  • Check selected state: use rp.selected or not rp.selected. This attribute accepts the Boolean values true and false. There is no short name for selected in this attribute space.
  • Check the selection flag: use rp.sf, the short form of rp.selectionFlag. For example, rp.sf false checks for a false value; rp.sf is also shown as an example.

Make queries easier to maintain

Short forms are convenient when you already know what an expression means. For a query you expect to revisit—or share with a colleague—the full attribute name can be easier to interpret at a glance. In particular, writing rp.selectionFlag instead of rp.sf makes the intent more apparent to someone who does not use NSL every day.

Keep the attribute space in the expression. The prefix rp indicates that you are querying render preset attributes, and the documentation specifies that this space matches only render preset nodes. This is useful context when reading a query later: rp.selected is not simply a general check for any selected node.

Also keep the three checks separate. A name query asks about the preset’s name; selected asks about its selected state; and selectionFlag is a distinct inherited attribute. The reference lists them separately, so use the one that matches your intended test rather than assuming one implies another.

A quick query checklist

  1. Confirm you want to match render preset nodes.
  2. Choose the attribute that answers your question: name, selected, or selectionFlag.
  3. For a name, put the value in quotes. For the Boolean attributes, use true or false as appropriate.
  4. Use the full attribute name when clarity matters, or the documented short name when brevity helps.

These small habits make NSL expressions easier to check, reuse, and discuss—especially when you are troubleshooting a query or handing it to someone else. For the complete attribute reference and examples, see the render preset attributes documentation.

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

Comments are closed.