Creating Python scripts to automate molecular modeling tasks can be both powerful and time-consuming—especially for researchers who aren’t scripting experts. Fortunately, the /script command in SAMSON AI offers a way out of repetitive and error-prone manual workflows. If you’ve ever thought, “I wish I could just describe what I want and have a script generated for me,” SAMSON AI might be exactly what you need.
This blog post explores how /script in SAMSON AI makes custom scripting accessible to anyone working with molecular models. Whether you’re running molecular dynamics pre-processing, visualizing structural properties, or developing your own tools, this feature can save you time while improving reproducibility.
Why It’s Useful
Many researchers want to automate repeated tasks—such as selecting atoms, applying transformations, or analyzing parts of a molecule—without diving deep into the intricate syntax of the SAMSON Python API. SAMSON AI bridges this gap by allowing you to describe in natural language what you want to do. Then, it automatically generates and runs Python scripts that interact with your molecular scene accordingly.
How It Works
To use this feature, simply bring up the Assistant via the menu (Interface > Assistant) or the shortcut (Ctrl + 0 on Windows/Linux, Cmd + 0 on macOS). In the prompt box, type your instruction preceded by /script.
Here are a few practical examples of what SAMSON AI can do with your input:
/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.
Behind the scenes, these commands tap into the SAMSON Python API, which allows detailed control over selections, geometry, visual styles, and even user interface elements. You don’t need to worry about imports or functions—the Assistant handles it all and shows you what was generated.
Expanding Your Workflows
This feature isn’t just helpful for small edits. Combined with external Python libraries, you can use SAMSON AI’s generated scripts as templates for more advanced projects involving:
- Trajectory analysis workflows
- Machine-learning predictors
- Custom visualizations and data extraction
Since the Python scripts are editable, you can treat them as a great starting point for more sophisticated pipelines—especially useful when collaborating with computational colleagues or scaling up repeated studies.
Who Benefits from This?
This capability is useful both for non-programmers who need custom actions and for more advanced users who want a boost in prototyping. Instead of searching documentation to find the right API call, start with your idea and refine the script from what SAMSON AI proposes.
Tip: Use this as a learning tool too! By comparing your natural-language prompt with the resulting code, you can understand how specific tasks are implemented using the SAMSON API.
Learn more about the /script command and other features in the official 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.
