Home Examples Screenshots User manual Bluesky logo YouTube
OghmaNano Multiphysics simulation platform for optoelectronic devices and photonic systems DOWNLOAD Quick Start guide

The Step Editor: periodic object placement in OghmaNano

1. Introduction

Many photonic and electronic device structures are inherently periodic. A DFB (distributed feedback) grating requires a precisely spaced array of ridges or slots. A photonic crystal is built from a regular lattice of dielectric objects. A plasmonic metasurface consists of repeated resonator elements at sub-wavelength spacings. Constructing these structures object by object would be impractical, so OghmaNano provides a step editor that takes a single object and automatically generates copies of it at specified positions in 3D space.

An important property of this system is that every copy shares the same optical and electrical parameters as the original. The copies are not independent objects — they are a cluster of exact replicas, all inheriting the material assignments, layer properties, and optical constants of the parent object. This makes it straightforward to modify the entire periodic structure by editing only the original.

The step editor offers three modes of increasing complexity: a basic step mode for simple uniform arrays, a crystal mode for structures defined by primitive lattice vectors, and a Lua scripting mode for fully arbitrary point distributions.

2. Accessing the step editor

To access the step editor, start from the main OghmaNano simulation window (??). Right-click on the object you wish to replicate and select Edit object from the context menu. This opens the object editor, shown in ??.

In the object editor, locate the Steps row. This row displays the current step parameters — the displacement (dx, dy, dz) between copies and the number of copies (nx, ny, nz) in each direction. Click the … Edit button at the right-hand end of the Steps row to open the step editor window.

OghmaNano main simulation window showing a periodic array of objects with a right-click context menu open, highlighting the Edit object option
Right-click on the object of interest in the main simulation window and select Edit object to open the object editor.
OghmaNano object editor showing the Steps row with dx, nx, dy, ny, dz, nz fields and an Edit button with three-dot access to the step editor
The object editor. The Steps row shows the current step configuration. Click the … Edit button to open the step editor.

3. Basic step mode

The step editor opens in Basic step mode by default, as shown in ??. This mode is the simplest way to create a 1D, 2D, or 3D array of objects. It takes a single step vector (dx, dy, dz) and tiles the object that many times along each axis. The fields are:

For example, to create a 1D grating of 10 elements spaced 209 nm apart along z, set dz = 209 nm, nz = 10, and leave dx and dy at zero. This is the configuration shown in ??, which corresponds to a simple DFB grating period.

OghmaNano step editor in Basic step mode showing step fields dx, dy, dz and number of objects x, y, z. dz is set to 209 nm and nz to 10, producing a 1D array along z.
The Basic step mode. A single step vector (dx, dy, dz) and object count (nx, ny, nz) define a uniform 1D, 2D, or 3D array. Here a 1D array of 10 objects spaced 209 nm apart along z is configured.
OghmaNano step editor in Crystal mode showing primitive lattice vector fields a1, a2, a3 with x, y, z components, an Origin field, and Number of objects fields.
The Crystal mode. Three primitive lattice vectors a1, a2, a3 define the unit cell, and the object is tiled across the resulting Bravais lattice.
OghmaNano step editor in Lua script mode showing a code editor with clear_points() and add_point() commands and a Refresh button to update the 3D view.
The Lua script mode. Points are placed at arbitrary (x, y, z) coordinates using add_point(). Click Refresh to update the 3D view.

4. Crystal lattice mode

For structures with non-orthogonal or non-uniform periodicity, click the Crystal button in the step editor toolbar to switch to crystal mode (??). This mode defines the periodic arrangement using three primitive lattice vectors a1, a2, and a3 — the same formalism used in crystallography to describe a Bravais lattice.

Each object position is computed as:

\[ \mathbf{r}_{ijk} = \mathbf{r}_0 + i\,\mathbf{a}_1 + j\,\mathbf{a}_2 + k\,\mathbf{a}_3 \]

where i, j, k are integer indices running from 0 to nx−1, ny−1, nz−1 respectively, and r₀ is the origin. By choosing a1, a2, a3 appropriately, any Bravais lattice can be constructed — simple cubic, face-centred cubic, body-centred cubic, hexagonal, or any custom non-orthogonal arrangement.

5. Lua scripting mode

For fully arbitrary point distributions — spirals, helices, quasicrystals, or any geometry that cannot be expressed as a simple lattice — the step editor provides a Lua scripting interface, accessible by clicking the Lua script button (??).

Two built-in functions are available in this context:

Any valid Lua code can be used between these calls, including loops, conditionals, trigonometric functions, and random number generation via math.random(). After editing the script, click Refresh to regenerate the point distribution and update the 3D view.

A simple example — placing objects at equally spaced positions along z with a small random roughness applied to each position — is shown below. This is useful for modelling fabrication disorder in grating structures:

clear_points()

N = 14
lambda = 240e-9
roughness = 4e-9    -- set to 0, 1e-9, 2e-9, 5e-9, etc.

z = 0.0

for n = 1, N do
    for i = 1, 10 do
        add_point(0.0, 0.0, z + (math.random() * 2.0 - 1.0) * roughness)
        z = z + lambda
    end
end

6. Example: hexagonal lattice

A practical example of the crystal mode is the construction of a hexagonal lattice, as might be used for a photonic crystal or a hexagonally packed array of nanopillars. The lattice editor configuration is shown in ?? and the resulting 3D structure in ??.

OghmaNano crystal editor configured for a hexagonal lattice. a1 is set to (3 µm, 0, 0), a2 to (1.5 µm, 2.59 µm, 0), a3 to (0, 0, 3 µm), with 3×3×3 objects.
Crystal editor configured for a hexagonal lattice with lattice parameter 3 µm. a1 = (3 µm, 0, 0), a2 = (1.5 µm, 2.59 µm, 0), a3 = (0, 0, 3 µm).
OghmaNano 3D simulation window showing a hexagonal array of red spheres arranged in a close-packed hexagonal pattern, viewed from above and to the side.
The resulting hexagonal lattice in the OghmaNano 3D view. The 60° offset between rows is clearly visible, consistent with the a2 vector at 60° to a1.

The key values are a2_x = a/2 = 1.5 µm and a2_y = a√3/2 = 2.598 µm, which together give the 60° angle between a1 and a2 that defines hexagonal symmetry. The out-of-plane vector a3 is simply the layer-to-layer repeat distance along z.

7. Example: double helix using Lua scripting

A more visually complex example of what the Lua scripting mode can produce is a double helix — two interleaved helical strands winding around a common axis. This geometry cannot be expressed as a Bravais lattice and requires the scripting interface. The Lua code is shown in ?? and the resulting structure in ??.

OghmaNano Lua script editor showing the double helix code. Two helical strands are generated using sin and cos functions offset by pi, with 200 points per strand over 6 turns.
The Lua script for the double helix. Two strands are generated using parametric trigonometric functions, offset from each other by π radians around the helix axis.
OghmaNano 3D simulation window showing a green double helix structure — two interleaved helical strands winding along the z axis over six complete turns.
The double helix rendered in the OghmaNano 3D view. Two interleaved strands wind over six complete turns, demonstrating the flexibility of the Lua scripting mode for generating non-periodic geometries.

The complete Lua script for this structure is:

clear_points()

N = 200
radius = 1.5e-6
pitch = 3e-6
turns = 6

for i = 1, N do
    t = (i / N) * turns * 2 * math.pi

    -- first helix strand
    x1 = radius * math.cos(t)
    y1 = radius * math.sin(t)
    z1 = (i / N) * turns * pitch
    add_point(x1, y1, z1)

    -- second helix strand offset by pi (opposite side)
    x2 = radius * math.cos(t + math.pi)
    y2 = radius * math.sin(t + math.pi)
    add_point(x2, y2, z1)

end

Each strand is traced by stepping the parameter t from 0 to 2π × turns. The x and y coordinates follow a circle of the given radius, while z increases linearly with t at the specified pitch. The second strand is offset by π radians — placing it on the opposite side of the helix axis at each point — which produces the characteristic interleaved double-helix geometry.

8. Summary

The step editor in OghmaNano provides three complementary methods for placing objects periodically in 3D space. Basic step mode handles simple uniform arrays with a single displacement vector. Crystal mode supports any Bravais lattice through three primitive vectors a1, a2, a3, enabling hexagonal, cubic, or custom non-orthogonal arrangements. Lua scripting mode removes all geometric constraints, allowing points to be placed at arbitrary coordinates computed from any mathematical expression — as illustrated by the double helix example above. In all three modes, every copy of the object inherits the same optical and electrical properties as the original, so the entire periodic structure can be modified by editing a single object.