Quickly Find and Filter File Nodes in SAMSON Using NSL

One of the challenges that molecular modelers often face is managing the many different types of data in their workspace. Whether you’re dealing with molecule structures, calculation results, or external inputs, your project in SAMSON can quickly fill up with a tangle of nodes. This becomes particularly relevant when working with files, which are stored in file nodes. Being able to easily filter and control these nodes is essential for a smooth modeling workflow.

Here’s the good news: SAMSON’s Node Specification Language (NSL) provides a straightforward way to query and work with file nodes using well-defined attributes. In this blog post, we’ll look at how to use fi—the file attribute space—to find and control file nodes effectively.

What is the fi attribute space?

The fi (short for file) attribute space is designed specifically to match file nodes in SAMSON. This lets you run precise queries like:

  • Finding a file by name
  • Identifying which files are selected
  • Filtering based on selection flags

Each attribute under fi can help you write powerful expressions in NSL—for automation, data exploration, or just to clean up your workspace more easily.

1. Searching File Names

If you want to search by name, you can use the name attribute (short form: n). For instance, the following NSL commands help you locate files:

The first line finds all file nodes with the name A; the second finds all file names starting with L. This is especially useful when you’re dealing with simulation outputs that follow naming patterns.

2. Checking Selection Status

Sometimes, you’re only interested in what is currently selected. Use the selected attribute (no short form) to quickly filter those nodes:

This returns all file nodes currently selected in your workspace. To invert it, simply write:

3. Using the Selection Flag

The selectionFlag attribute (short form: sf) works slightly differently from selected. It lets you test whether a file node has its internal selection flag set. For example:

…will find all file nodes whose selection flag is false. This attribute can help you build more refined filters when scripting or creating node-based workflows.

Combining Attributes

NSL allows combining these queries. For instance, if you’re looking for all selected file nodes that start with L in their name:

This kind of filtering saves time, especially when your project has many nodes.

When does this become useful?

Here are just a few practical examples:

  • Organizing simulation result files
  • Automating selection for batch processing
  • Cleaning up unselected or unused import files

Learning how to use fi.n, fi.selected and fi.sf will help you gain more control over what you see and what operations you perform within SAMSON, especially when working with complex molecules or multi-step simulations.

To learn more, visit the full documentation page here: https://documentation.samson-connect.net/users/latest/nsl/file/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.

Comments are closed.