Molecular modeling often involves repetitive tasks where writing scripts becomes a necessity—whether to automate selection, manipulate structures, or analyze properties. But what if you could generate those scripts just by describing what you want in plain English?
That’s exactly what the /script command in SAMSON AI is designed for. It serves as a bridge between natural language and Python code written with the SAMSON Python API, providing a useful shortcut for busy computational chemists, structural biologists, and drug designers.
Why scripting is a common pain point
Let’s face it: scripting takes time—especially if you’re switching between different projects or platforms. Even if you’re a Python expert, there’s friction when it comes to looking up syntax, recalling specific API functions, or simply typing boilerplate interactions with molecular models.
And if you’re not a programmer? Simple tasks like translating atoms or calculating properties can be a real hurdle.
Natural language meets molecular Python
SAMSON AI simplifies Python scripting with the /script command. Just describe what you need:
/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.
SAMSON AI translates these requests into actual Python code using the SAMSON API. You’re no longer starting from a blank script—you’re starting from something that works.
What it means in practice
This prompt-based scripting capability doesn’t just save time—it encourages experimentation. You can:
- Quickly prototype ideas and workflows
- Use AI-generated code snippets as starting points for larger projects
- Combine SAMSON scripting with other libraries like NumPy or SciPy
Best of all, it’s great for teams: even team members with limited coding experience can contribute by generating or editing scripts easily.
When to use it
The /script command is especially useful when you:
- Need to manipulate 3D structures in precise ways
- Want to automate tasks such as selection, coloring, or filtering
- Plan to add interactive widgets like GUIs inside SAMSON
It also helps newcomers learn by example since the generated scripts show how to use the API effectively.
Getting started
Once SAMSON is open, launch SAMSON AI via Interface > Assistant or press Ctrl + 0 on Windows/Linux, or Cmd + 0 on Mac. Then type /script followed by your task description, and you’ll get usable code instantly.
Want to dive deeper into the scripting API? Visit the SAMSON Python API documentation.
To explore more SAMSON AI commands and capabilities, check out the full documentation at 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.
