Molecular modelers often face a recurring challenge: how to efficiently select, modify, and edit atomic properties to create custom nanoscale shapes. While traditional tools can address these needs, many require repetitive manual adjustments or lack adaptability for unique requirements. SAMSON’s Simple Script Extension offers a powerful scripting environment to tackle these issues effectively, making molecular editing not only precise but also intuitive and creative.
Why Use the Simple Script Extension?
The Simple Script Extension empowers users to modify atomic properties such as positions, visibility, chain IDs, charges, and more with mathematical expressions and scripting. It caters to those seeking fast, scalable solutions for atomic customization, whether you’re generating complex nanoscale structures or slicing advanced atomic configurations.
Step-by-Step Example: Setting Atomic Structures in Motion
To understand the power of this tool, let’s dive into generating a sinusoidal graphene sheet by adjusting the z-coordinate of all atoms:
|
1 |
a.z := sin(a.x * π / 12); |
Running this simple script modifies the z-coordinate of each atom based on its x-coordinate, effectively creating a wave-like atomic structure along the z-plane. Below is a visualization of the process:

Efficient Selection of Atoms
The Simple Script Extension also simplifies atom selection for detailed editing. For example, selecting all Carbon (a.element == 'Carbon') and Hydrogen (a.symbol == 'H') atoms can be achieved with:
|
1 2 |
if (a.element == 'Carbon' or a.symbol == 'H') n.sf := 1; else n.sf := 0; |
Using the selectionFlag (sf), you can then manipulate properties of the selected atoms while keeping the rest untouched.
Advanced Customization: Creating Nano-Batarangs
One of the most exciting applications of Simple Script is its ability to turn imagination into nanoscale reality. For example, using a graphene sheet placed in the z-plane, it’s possible to create a nano-sized version of Batman’s famous batarang. The script determines which atoms belong to the batarang using mathematical conditions and adjusts their visibility and selection flags accordingly:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/* Batman's sign */ var x := a.x / 2; var y := a.y / 2; var iambatman := false; if ((abs(x) > 3 and y >= 0) or (abs(x) > 4 and y < 0)) { if ((x/7)^2 + (y/3)^2 < 1) iambatman := true; } if (iambatman) { n.sf := 1; a.vf := 1; } else { n.sf := 0; a.vf := 0; } |
This script selectively reveals and highlights atoms, transforming a flat graphene sheet into a batarang design with nanoscale precision. Here’s what it looks like in motion:

Learn More and Get Started
If molecular modelers can imagine it, the Simple Script Extension can likely help create it, from sinusoidal designs to detailed molecular shapes like nano-batarangs. For a comprehensive guide and more inspiring examples, visit the original documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. You can get started by downloading SAMSON from SAMSON Connect.
