Molecular modelers increasingly rely on scripting to streamline repetitive tasks, automate analyses, or create custom simulations. If you use Python in your workflow, integrating scripts directly into your modeling environment can dramatically reduce friction and time.
SAMSON, the integrative platform for molecular design, supports Python scripting natively—helping scientists and engineers accelerate their modeling and simulation pipelines.
Why scripting directly in SAMSON?
Scripting in a molecular modeling platform without switching contexts means:
- No need to export/import data between applications.
- Access to the entire molecular scene, parameters, and calculation tools within the same script.
- Rapid prototyping of visualizations, measurements, or transformations.
Python files in SAMSON
SAMSON supports the standard .py extension for Python files. You can:
- Read any Python file, including external scripts.
- Write edits back to disk within the built-in Code Editor.
- Execute your script immediately in SAMSON’s environment.
Getting started with scripting
To begin scripting in SAMSON, all you need to do is:
- Open the Code Editor from the interface.
- Open an existing Python script or create a new one.
- Write or modify your script to manipulate or analyze your molecular data.
- Save and execute the script within SAMSON.
For example, you can write a script to:
- Color residues based on properties.
- Measure distances or angles automatically.
- Batch-process multiple molecular systems.
- Generate custom trajectories or animations.
Beyond standalone scripts
One useful feature is that SAMSON lets you embed Python files inside SAMSON Documents. That means your entire project, including data and automation scripts, can be encapsulated in a single shareable file with the .samx extension.
This makes collaborative science easier because there’s less room for version mismatches or forgotten dependencies. Colleagues can open your file and immediately access code and data together.
When should you use scripting?
If you’re repeating manual steps in SAMSON—for example, selecting specific atoms, computing interactions, or tweaking visualization parameters—consider scripting it. It saves time and creates reproducible workflows you can share or build upon.
Where to learn more?
The SAMSON documentation offers a dedicated Python Scripting section with examples and best practices. The scripting API reflects the structure of molecular documents, giving you access to nodes, models, selections, and more.
Curious about the full list of supported file formats, including scripts, trajectories, and meshes? Check out the full documentation here »
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
