Master Molecular Modeling with Simple Script Extension in SAMSON

Molecular modeling often requires precise control over atomic properties to achieve desired outcomes. As a molecular modeler, you might have faced the challenge of editing atomic properties or performing complex selections at the atomic level. SAMSON’s Simple Script Extension offers a straightforward scripting interface to solve these challenges, enabling you to manipulate atomic properties with mathematical functions and logical expressions.

Why Use the Simple Script Extension?

Working at an atomic scale requires a way to control and modify specific properties of atoms efficiently. The Simple Script Extension gives you this capability by allowing the application of mathematical expressions directly to atom attributes such as position, visibility, or element type. This can save significant time and effort compared to manual adjustments, especially for larger molecular systems.

Getting Started with Variables

The extension connects scripting with atom-level control. Variables for atoms are defined as per SAMSON’s Node Specification Language, but here element symbols and names must use single quotation marks (e.g., 'Carbon', 'Fe'). Key attributes available for scripting include:

  • a.x, a.y, a.z: Atomic positions.
  • a.visibilityFlag: Controls visibility (1 for visible, 0 otherwise).
  • a.chainID, a.element, a.serialNumber: Identify elements or groups of atoms.

Using these, you can select atoms, change visibility, or reposition atoms in space, opening up a wide range of possibilities.

Powerful Capabilities at Your Fingertips

The scripting engine supports standard mathematical operators (+, -, *, /, %, ^), functions (e.g., sin, sqrt, log), and logic structures like if-then-else statements and loops (for, while). For example, shifting the y-coordinate of atoms identified by elementID == 2 is as simple as:

You can also use ternary operators for concise expressions:

Practical Examples

Here are some quick highlights to spark your imagination:

  1. Create sinusoidal patterns by modifying atomic z-coordinates based on the sin function:

    Sinusoidal graphene sheet example

  2. Hide atoms outside a spherical region:

  3. How about creating a nano-batarang out of graphene? Yes, that’s possible too with scripting! You can combine precision and creativity to carve unique shapes at the molecular level. Here’s a visual output of a nano-scaled batarang:

    Graphene batarang example

Why This Matters

These capabilities allow not just visualization but also the creation and modification of molecular structures with unparalleled control. Whether you’re interested in creating realistic models or crafting imaginative shapes like the famous batarang, the Simple Script Extension is a versatile tool for molecular designers.

To dive deeper into examples or learn how to unlock its full potential, check the official documentation page.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at samson-connect.net.

Comments are closed.