When working on molecular modeling projects, many researchers face a common challenge: repetitive, manual tasks that cost time and lower reproducibility. Whether it’s translating structures, computing simple properties, or automating a workflow, scripting offers a way out—if you know how to code.
But what if you’re not an experienced Python developer, or simply don’t want to switch back and forth between the GUI and an IDE? This is where SAMSON AI, the intelligent assistant for the SAMSON platform, offers a useful middle ground—bridging natural language and scripting.
Introducing /script: Natural Language to Python
SAMSON AI includes a powerful command: /script. With it, you can generate functional Python code just by describing what you want to do, using ordinary language. Your instruction is translated into a Python script that uses the SAMSON Python API, which you can then edit or run directly.
Here are some examples you can try right now:
/script select all atoms and translate them in the z direction by 1 angstrom./script create a GUI that lets me enter a distance in angstrom, with a 'Move' button./script compute the gyration radius of the receptor.
Why It Matters
Writing scripts from scratch can be intimidating, particularly for those who don’t script every day. The /script feature addresses this by supplying clean, ready-to-run code that’s tailored to your molecular modeling command—and unlike static tutorials, these scripts are context-aware.
Do you often run similar tasks, like measuring the distance between atoms or saving surface models for analysis? With /script, you can quickly generate those operations as reusable building blocks, making your workflows faster and more consistent.
Combining Scripts with Other Tools
Because scripts are written in Python, you have the flexibility to expand them using standard libraries like numpy or pandas, or apply machine learning with frameworks such as scikit-learn or torch. This opens the door to powerful integrations, from statistical analysis to interactive dashboards—all without leaving the SAMSON environment.
Even better, you can combine scripting with other SAMSON AI capabilities. For instance, select structures using /select, generate a script based on the selection, and use /do to manipulate the visual results—all within a single, AI-assisted session.
When to Use /script
Here are a few situations where this command can be especially helpful:
- You want to automate a modeling task but don’t remember the API syntax.
- You’re prototyping a workflow and want to see if a scripting approach works.
- You prefer learning-by-doing over reading documentation line-by-line.
Once generated, you can study the script, tweak it, and reuse it in future projects. It’s a learning tool and a productivity booster rolled into one.
To try this feature, open the Assistant via Interface > Assistant or with the Ctrl + 0 shortcut on Windows/Linux (Cmd + 0 on macOS).
Learn more in the full SAMSON AI documentation: https://documentation.samson-connect.net/users/latest/samson-ai/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
