Python Scripting in SAMSON: Automate, Simulate, Repeat

For molecular modelers who spend long hours clicking through visualization and simulation pipelines, interacting with complex systems through a GUI can be both repetitive and limiting. Wouldn’t it be better if you could automate your process, access advanced analytics, or build your own computational workflows — all in one place?

SAMSON, the integrative molecular design platform, addresses this with full-fledged Python scripting support. Whether you’re modeling molecular systems, running simulations, or exploring biomolecular properties, scripting unlocks a high degree of flexibility and reproducibility. Here’s how you can get started and make the most of Python scripting in SAMSON.

Python Everywhere: Console, Editor, and Embedded Scripts

SAMSON integrates Python directly throughout the platform with support for:

  • A built-in Python Console powered by the Jupyter Qt interface
  • A Code Editor based on Monaco (used in Visual Studio Code)
  • Support for embedding scripts directly into SAMSON documents

This means you can start scripting in the Python Console, create and run full workflows in the Code Editor, and even share interactive documents that include live Python code.

Python Console

Explore the SAMSON Python API

The SAMSON Python API gives you powerful access to SAMSON’s core functionalities. You can load molecular models, perform geometry modifications, run simulations, or create custom graphical user interfaces using PyQt — all from a Python script.

Need a script to build a pipeline or apply machine learning to structural data? You can do that within SAMSON, integrating packages for analytics, visualization, and more.

Automate with the Code Editor

The integrated Code Editor lets you write, edit, and run Python scripts in a familiar development environment, with syntax highlighting and auto-completion features. You can also access built-in templates covering common tasks such as loading molecules or applying visual styles, which makes learning and customization easier.

Code Editor

Manage Your Python Packages

SAMSON comes with a built-in Python Package Manager, so you can install libraries like numpy, pandas, or tensorflow within the platform. You can install, upgrade, or uninstall packages with pip-style syntax. Local packages can also be installed in editable mode for development.

Manage packages

Share Live Workflows

One standout feature is the ability to embed Python scripts into SAMSON documents. This means your entire workflow — models, code, data — can be packaged into a file that others can open and use right away. Share with your team, publish alongside a paper, or design student exercises: interactivity included.

Embed code

To learn more about scripting in SAMSON and find code snippets, templates, and examples, visit the full Python scripting documentation.

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

Comments are closed.