For many molecular modelers, scripting can be both empowering and intimidating. Python gives you immense control over molecular systems in SAMSON, but what if you’re not confident with the syntax? Or you just want to speed things up?
SAMSON AI introduces a command that turns natural-language prompts into executable Python code: /script. Whether you’re new to scripting or just looking to speed up your workflow, this is a game-changer for day-to-day modeling operations.
Why script with your words?
If you’ve ever been unsure how to structure a loop, didn’t remember how to import the SAMSON API, or hesitated to try a new analysis because it required coding, /script helps clear those roadblocks. Instead of searching syntax or examples online, you describe the task in plain English, and SAMSON AI provides an instant script you can tweak or run as is.
Examples that save time
Here are a few useful prompts you could use with /script:
/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.
What’s happening behind the scenes? The generated code uses the SAMSON Python API. This API exposes access to the molecular document and its nodes, as well as rendering, simulation, and selection utilities. Scripts can also be extended with packages like NumPy, pandas, or custom machine learning models.
Simplifying repetitive tasks
Need to color a selection by chain or setup a data export routine that formats atom coordinates for a collaborator? You could write it by hand, or now, just describe it to SAMSON AI. For example:
/script export all ligand atom coordinates to a CSV file
The response will be a fully functional script using the SAMSON API and standard Python modules, freeing you from boilerplate code and letting you focus on what’s unique to your research.
Getting started
You can open SAMSON AI via Interface > Assistant or with the keyboard shortcut Ctrl + 0 (Windows/Linux) or Cmd + 0 (macOS).
In the Assistant panel, just type /script followed by what you want the script to do. You’ll get a Python script in return, ready to be reviewed or executed in SAMSON’s scripting environment.

Whether you’re automating selections, building user interfaces, or testing analyses across many conformations, SAMSON AI helps lower the barrier between scientific goals and Python implementations.
To learn more about scripting with SAMSON AI, visit the official documentation here: https://documentation.samson-connect.net/users/latest/samson-ai/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download the platform at https://www.samson-connect.net.
