Sharing molecular modeling workflows with colleagues or students often involves zipping together input files, scripts, images, and documentation — and hoping they preserve the folder structure when unpacking. But what if you could combine everything — models, scripts, data, and documentation — into a single, portable, self-contained file that just… works?
This is exactly what embedded Python scripting in SAMSON allows you to do. By embedding Python scripts and even full apps inside SAMSON documents, you can streamline collaboration, teaching, and reproducibility in your projects.
Why Embedded Scripts Matter
In molecular modeling, reproducibility is a recurring challenge. When methods are described outside the modeling document, especially using external scripts or tools, recreating a result can quickly become a guessing game.
SAMSON addresses this by supporting Universal File Embedding. Within a SAMSON document, you can embed:
- Python scripts or even full Python-based apps
- Data files (e.g., CSV, PDB, topology files)
- Figures, supplementary documents, or papers
This makes your modeling document not only a model but also an interactive research notebook.
How It Works
To embed files or folders into a SAMSON document:
- Drag-and-drop them into the SAMSON window
- Or use Home > Embed files or Home > Embed folders
An Embed File Dialog will appear asking whether to embed the files:

Once embedded, the files are integrated into the SAMSON document — meaning you can send the document via email or share it via GitHub or an intranet without worrying about missing pieces or incompatible environments.
Open and Run the Code
You or your collaborators can simply double-click on an embedded Python script to open it in SAMSON’s Code Editor. From there, you can modify or run the code using the integrated Python console, which supports Jupyter-style interaction.
This setup is very useful to:
- Researchers who want to distribute executable protocols
- Educators providing interactive lessons or exercises to students
- Collaborators working asynchronously, where clarity and reproducibility are key
A Few Use Cases
- Share a SAMSON document with embedded code for setting up and running a molecular simulation
- Publish a molecular model with accompanying analysis scripts for full reproducibility
- Create interactive tutorials where students learn by modifying and running embedded code
You can even embed multi-file Python applications, such as machine learning models or visualization dashboards. Since everything is stored within the SAMSON document, there’s no risk of code or data being separated from the model.
Conclusion
Embedded Python scripting in SAMSON provides a simple and reliable way to make your molecular modeling work reproducible and easier to share. Whether you are collaborating across labs or giving students hands-on material, packaging models and methods inside a single file can save time and avoid confusion.
To learn more about scripting in SAMSON, visit the SAMSON scripting documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON from https://www.samson-connect.net.
