Using Python Scripts in SAMSON: A Simple Way to Automate Molecular Modeling

For many molecular modelers, one recurring challenge is the lack of flexible scripting capabilities in their software tools. Whether the goal is to extract custom properties, automate repetitive tasks, or prototype an analysis workflow, scripting support can often make the difference between hours of manual work and a streamlined, shareable pipeline.

If you haven’t yet explored Python scripting in SAMSON, it might be a good time to take a closer look. SAMSON provides easy support for Python scripts directly within the platform through its integrated Code Editor. This means that without leaving your molecular modeling environment, you can read, write, and execute Python files (.py), whether it’s for automation, data extraction, or visualization.

Why Python in SAMSON?

Python has become a standard in scientific computing, and its integration in SAMSON brings immediate benefits:

  • 🧪 Automate model setup or analysis across multiple systems
  • 📊 Perform custom calculations and generate plots
  • 📁 Batch-process files using supported formats
  • 🔄 Write simple scripts to convert file formats or reformat data

What You Can Do

Supported Python scripting features in SAMSON include:

  • Read: Open existing Python files directly in the integrated editor
  • Write: Save your scripts as part of a SAMSON project or standalone
  • Execute: Run scripts within the SAMSON environment without switching tools

This immediate execution capability is particularly useful when testing new molecular manipulations or analyzing properties of a simulation loaded into the platform. Whether your workflow involves multiple simulation outputs or you simply want to automate documentation generation, having Python at your fingertips makes a big difference.

Embedding Scripts in Projects

Another useful feature is that Python files can be embedded within SAMSON Documents—meaning your collaborators can receive not only your simulation results, but also the code you used to generate them, streamlining reproducibility and transparency 💡.

File Format Overview

According to SAMSON’s supported formats documentation, Python scripts are fully integrated:

File Type Read Write Execute
PY ✔️ ✔️ ✔️

Getting Started

To begin writing scripts, open the Code Editor from within SAMSON, create a new Python file, and start coding. You’ll be able to interact directly with the loaded molecular systems, hooks to the SAMSON API, and export your outputs as needed. The scripting page in the documentation is a good starting point: Python Scripting in SAMSON.

Automation doesn’t need to be complicated—and in SAMSON, scripting makes it a natural part of your modeling workflow.

To learn more, visit the full documentation page on Supported Formats in SAMSON.

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

Comments are closed.