For molecular modelers and researchers, streamlining workflows and automating repetitive tasks is often a pressing need. Whether you’re analyzing complex molecular structures, running simulations, or creating custom analytical pipelines, the last thing you want is to be bogged down by tedious manual processes. Thankfully, SAMSON provides an integrated Python scripting environment that can significantly enhance your productivity and advance your projects efficiently.
What’s Special About Python Scripting in SAMSON?
SAMSON allows you to deeply integrate Python scripting into its platform, making it easy to automate tasks, run reproducible workflows, and even build advanced pipelines. The environment includes:
- A comprehensive SAMSON Python API that provides access to nearly all platform functionalities.
- A built-in Python Console powered by the Jupyter Qt Console to interactively run code and test scripts.
- A convenient Python Package Manager to install, uninstall, or manage various Python packages with ease.
- An advanced Code Editor equipped with syntax highlighting, auto-completion, and the ability to run scripts seamlessly within the platform.
With these tools, you can not only control your molecular models but also leverage powerful data analysis techniques, visualization libraries, and even integrate advanced Python packages for deep learning or bioinformatics tasks.
Getting Started: Python Console
The Python Console in SAMSON lets you instantly execute Python commands and automate workflows. You can access it by navigating to Interface > Python Console. It supports stepwise development by allowing you to test individual commands interactively.

If you’re just starting with scripting within SAMSON, the Python Console is a great place to experiment and familiarize yourself with the API.
Installing and Managing Python Packages
Need a particular library for your project? SAMSON makes it simple to manage Python packages through its dedicated Package Manager. To access this, open the Python Console and go to Edit > Manage packages….

Here, you can:
- Install packages directly from PyPI by entering the package name.
- Uninstall unused or outdated packages.
- Install local Python packages, even in “editable” mode for dynamic development.
You also have fine-grained control via pip flags. For example, you can use package_name==1.2.0 to specify a version or package_name --upgrade to upgrade a package.
Boost Productivity with the Code Editor
SAMSON’s Code Editor, backed by Monaco Editor (the same editor at the heart of Visual Studio Code), provides an intuitive and feature-rich environment for scripting. From syntax highlighting to built-in debugging features, the editor is designed to offer a seamless coding experience.
You can open the Code Editor by navigating to Interface > Code Editor and start scripting immediately. It even allows you to run your scripts with just one click using the “Run” button (
).

The editor also provides pre-designed Python templates that demonstrate best practices and specific usages of the SAMSON Python API. These templates are an excellent way to learn and get inspired by real-world examples of molecular modeling, visualization, and simulation tasks.
Embedding Scripts for Reproducibility
One of SAMSON’s most remarkable features is the ability to embed Python scripts directly into SAMSON documents. This makes sharing workflows and ensuring reproducibility a breeze. Embedded scripts stay within the document file, so colleagues and collaborators can seamlessly run your workflows without additional setup.

Whether you’re a researcher aiming to streamline your publications or an educator looking to create interactive exercises, embedding scripts opens up new ways to collaborate and teach.
Conclusion
The Python scripting environment in SAMSON is built to address the needs of molecular modelers, educators, and researchers who seek efficiency, customization, and reproducibility. By utilizing the Python API, built-in tools, and advanced features like embedded scripts, you can unlock the full potential of your projects.
To dive deeper into Python scripting with SAMSON, explore the official documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON from samson-connect.net.
