When working with complex molecular systems in SAMSON, things can get quite crowded. You may have multiple property models attached to atoms, molecules, or higher-level structures, and you just want to operate on a specific subset—like only those that are visible, or only those actively selected. Avoiding visual clutter and targeting the right nodes saves a lot of time, especially in scenarios involving material assignments, visibility toggles, or export workflows.
Fortunately, the Node Specification Language (NSL) in SAMSON makes this kind of filtering precise and efficient. In this post, we’ll focus on how to use attributes like visible, selected, and selectionFlag from the propertyModel attribute space to build powerful filters that target exactly what you want. 🧪✨
Why This Matters
Let’s say you’re building a surface property model to analyze electrostatics, but the system contains multiple similar models cluttering the workspace. Or maybe you only want to isolate models that are currently visible to apply a new material or remove them after use. Manually doing this wastes time and risks errors.
Using NSL Attributes for Filtering
The propertyModel attribute space (pm for short) includes several binary flags that can be used directly in filters:
pm.selected– Filters property models that are currently selected in the Document View or viewport.pm.v– Filters based on visibility (this flag tells whether the model is currently shown or hidden).pm.sf– The selection flag. Unlikepm.selected,pm.sfis persistent and can be useful for scripting or transition states.
Examples
Here are a few super practical examples of queries you could execute in SAMSON:
pm.v— All visible property modelsnot pm.v— All hidden property modelspm.selected— All currently selected property models (no short name, be sure to type it out)pm.sf false— Property models without the selection flag activatedpm.v and pm.selected— Visible and selected property models (commonly useful for exporting only what you see)
These queries can be entered in the Find widget or script commands throughout SAMSON, and are a great way to manage large document trees more comfortably.
A Note on Visibility vs. Visibility Flags
A frequent point of confusion is the difference between pm.v (visibility), and pm.vf (visibility flag). While pm.v indicates the current state (whether something is visible), pm.vf can express a target for display updates or scripts. Stick to pm.v for filtering what’s visible right now.
Additional Tip: Use pm.n to Filter by Name
If you name your property models with meaningful patterns (e.g., “Electrostatics”, “Hydrophobicity”), try queries like:
pm.n "Electro*"— Filters property models whose name starts with “Electro”pm.v and pm.n "*Field"— Visible property models whose names end in “Field”
Together with visibility and selection filters, name-based queries let you work much faster in systems with many models.
To learn more or explore other filterable attributes like hasMaterial and ownsMaterial, check the full documentation at this page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
