Automation and Scripting
Why automate simulations?
Once a device structure has been set up, the natural next step is often to ask questions such as: “What happens to my solar cell efficiency if I change the mobility of the active layer?” or “How does the emission wavelength of my laser shift if I vary the thickness of the quantum well?” Answering these questions requires systematically changing one or more material parameters over a range of values and then analyzing the resulting data. Doing this manually is slow, error-prone, and not scalable. Automation provides a faster and more reliable way to explore design spaces and gain insight into device physics.
Benefits of automation
- Batch runs: Automate hundreds or even thousands of simulations in one go, exploring wide parameter ranges without manual intervention.
- Reproducibility: Automated scripts ensure that simulations are performed consistently, making results easy to reproduce and share.
- Optimization: Automated workflows can systematically search for optimal device configurations, such as maximizing power conversion efficiency (PCE) or tuning laser emission wavelengths.
- Integration: Scripts can link OghmaNano with external analysis tools (e.g. Python + NumPy/matplotlib, or MATLAB toolboxes), streamlining the path from simulation to publication.
Methods of automation
OghmaNano offers several approaches to automating simulations, depending on your level of coding experience and the complexity of the task:
-
Parameter Scan Window: The parameter scan window allows you to vary one or more parameters in steps using the graphical user interface. No coding knowledge is required, making it ideal for quick exploratory studies. This method covers the majority of everyday use cases where you simply want to see how a parameter influences the results.
-
Python Scripting: For more fine-grained control, OghmaNano supports Python scripting. Python is open source, widely used in scientific computing, and provides maximum flexibility to adjust simulation parameters, automate large batch runs, or integrate with external libraries for analysis and visualization. This method is especially powerful for research workflows.
-
MATLAB Scripting: Another option is MATLAB scripting. MATLAB is familiar to many scientists and engineers, so it provides an accessible way to automate simulations. The drawback is that MATLAB is commercial software and not everyone has access to it. GNU Octave is a free alternative, but at the time of writing it does not include a JSON reader/writer, which limits compatibility.
How automation works under the hood
All of these approaches rely on the same underlying principle: the OghmaNano simulation file (sim.oghma
) is systematically edited,
and the core engine (oghma_core.exe
) is executed to generate new results.
A key point to understand is that sim.oghma
is simply a ZIP archive containing a JSON file (sim.json
).
This file format is described in more detail
here.
If you can edit this JSON file—using Python, MATLAB, or indeed any programming language (C, C++, Java, Perl, PHP, Ruby, etc.)—you can automate OghmaNano.
👉 Next step: Now continue to understand the Oghma file format, including its structure and how simulation parameters are stored.