Write and Run Molecular Scripts Directly in SAMSON’s Code Editor

When working on complex molecular modeling tasks, Python scripting can save hours of repetitive work. However, switching between external editors, terminals, and visualization platforms often breaks your workflow and makes it harder to test and debug scripts on the fly. A big pain point for many molecular modelers is lacking a fully integrated environment where scripting meets visualization — live, in the same context.

This is where the Code Editor in SAMSON comes in. Based on the Monaco Editor (used in Visual Studio Code), it allows you to write, debug, and run Python scripts directly inside the platform — providing direct access to your molecular models and the SAMSON Python API without switching apps.

Code Editor Interface

Why it matters

Molecular modeling is inherently visual. When you write and execute scripts in an external IDE, you often need to switch over to a visualization platform, load your data again, and re-run your processes. The SAMSON Code Editor eliminates this step by integrating everything into one place.

What you can do with the Code Editor

  • Open and edit files: Open any text file, including Python scripts, directly within SAMSON.
  • Run Python scripts: Execute scripts using the play button in the left toolbar, in the Run menu, or in the embedded Python Console for quicker iterations.
  • Access the full Python API: Seamlessly interact with all SAMSON features through Python — add hydrogens, modify structures, analyze trajectories, access visual styles, and more. Switch quickly between scripting and visualization.
  • Create GUIs: Use PyQt to build graphical interfaces for your scripts and experiments, and run them entirely within SAMSON.
  • Use helpful templates: Start with preloaded script templates that show how to use the SAMSON API for practical tasks. These are especially helpful for new users.

No setup friction

There’s no need to install a separate IDE or set up a Python environment. Everything is already configured within SAMSON. The Code Editor gives you full syntax highlighting, code auto-completion, and immediate script execution — enabling faster prototyping and fewer bugs.

Templates to help you start

Not sure how to begin scripting? SAMSON provides built-in Python templates that demonstrate how to:

  • Load and manipulate molecular structures
  • Visualize molecular properties
  • Simulate or analyze data

Python templates

Combine with the Python Console

For simple tasks or interactive debugging, the Python Console is also accessible inside SAMSON. You can copy-paste code from the editor into the console, test commands, and refine your workflow without leaving the platform.

For education, research, and collaboration

Whether you’re a researcher developing molecular workflows, a professor teaching structural bioinformatics, or a student exploring Python in chemistry, having an integrated code editor enhances reproducibility and saves time. Paired with embedded documents, you can even share complete workflows, notes, and data as self-contained SAMSON documents.

To learn more about the scripting capabilities in SAMSON, visit the official scripting documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON to get started today.

Comments are closed.