MetaOptics: opensource software for designing metasurface optical element GDSII layouts

: Metasurfaces have recently emerged as a promising technology to realize ﬂat and ultra-thin optical elements that can manipulate light at sub-wavelength scale. The typical design ﬂow of a metasurface involves tedious Finite Diﬀerence Time Domain (FDTD) simulations followed by creation of a GDSII layout of the metasurface phase proﬁle, the latter being essential for fabrication purposes. Both these steps can be time-consuming and involve the usage of expensive software. To make the design process more straightforward, we have developed an open-source software called MetaOptics built using Python for designing a generic metasurface optical element. MetaOptics uses the FDTD simulated phase response data of a set of meta-atoms and converts the phase proﬁle of any given optical element into a metasurface GDSII layout. MetaOptics comes with in-built FDTD data for most commonly used wavelengths in the visible and infrared spectrum. It also has an option to upload user-speciﬁc dimension versus transmission phase data for any choice of wavelength. In this work we describe the software’s framework and provide details to guide users to design a metasurface layout using MetaOptics.


Introduction
Metasurfaces [1][2][3][4][5][6][7] are artificial two-dimensional periodic arrays (2D Metamaterials) of subwavelength meta-atoms, which can provide a spatially varying optical response (e.g. scattering amplitude, phase, and polarization). They are of interest as they can be used to manipulate and engineer optical wavefronts with sub-wavelength spatial phase resolution. The most widely used techniques to date, to vary the spatial phase response are based on refractive and diffractive optical elements. Refractive optical elements (ROE) are most efficient, but they are challenging to fabricate with high precision in the micrometer/nanometer scale with the available lithography and micromachining techniques. On the other hand, binary diffractive optical elements (DOE) are easy to design and fabricate with a single lithography step. However, they are inefficient as their phase is quantized to only two phase levels. Multi-level DOEs [8,9] offer higher efficiency but their fabrication process is challenging to optimize and it is often not possible to reproduce with fidelity. Spatial Light Modulators (SLM) are another popular device used to achieve phase modulation. While SLMs have the advantage of being tunable, they are expensive and relatively bulky, restricting their use to laboratory experiments. The minimum possible spatial phase resolution that can be achieved using ROEs, DOEs and SLMs is typically of the order of tens of micrometers for light wavelengths in the visible spectrum. On the other hand, metasurfaces can tweak light at sub-wavelength scale and hence, can provide a spatial phase resolution that is two orders of magnitude smaller than that is possible with DOEs and SLMs. Furthermore, the fabrication process of metasurfaces is relatively straight forward and involves only a single lithography step.
Metasurfaces can be broadly divided into three categories depending on their working principle. These are metasurfaces based on: (1) plasmonic antennas [1,[10][11][12], (2) geometric or Pancharatnam-Berry phase [13][14][15][16][17], (3) all-dielectric metasurfaces [5,7,18,19]. Typically, the design process of a metasurface involves rigorous Finite Difference Time Domain (FDTD) simulation followed by conversion of the desired phase profile into a metasurface Graphic Database System II (GDSII) layout for fabrication purposes. Both of these steps require in-depth knowledge and can intimidate a new researcher or an optical engineer who may not have expertise in the areas mentioned above. Furthermore, commercially available FDTD solvers are expensive, and the typical FDTD simulation involved in designing a metasurface can take anything from hours to days to complete. Therefore, metasurfaces are often not a researchers first choice in solving a phase generation problem, despite their many advantages.
In this paper, we present a powerful software called "MetaOptics" built using Python, with a simple graphical user interface (GUI) capable of providing intuitive and rapid control over designing a metasurface GDS layout. MetaOptics abstracts these difficult, expensive, and timeconsuming tasks, the FDTD and the GDSII layout conversion from the designer and generates metasurface GDS layouts for any given phase profile. These GDS layouts are essential for fabrication using lithography systems. In addition, we have also provided an option for users to upload their own FDTD data or data that was obtained from literature to convert their phase profiles into metasurface layouts. We demonstrated the design and fabrication of two all-dielectric metasurfaces composed of silicon cylindrical meta-atoms to generate an LG beam and a Bessel beam at 633 nm. This particular type of metasurface depends on the overlap of electric and magnetic dipole resonances to achieve the 0 -2π phase coverage to achieve wavefront engineering [5]. Currently, the software supports the three most widely used geometries for the meta-atoms, which are cylinder [5,6,18,19], cross [7,[20][21][22] and fin [14][15][16][17]23] shapes. Download links to the software source code and executable files can be found on our Laboratory's website [24].

Design flow of a metasurface for a given phase profile
Creating a metasurface device can be divided into four main parts, namely: (1) modelling meta-atom dimensions to achieve 0 -2π phase coverage for the wavelength of interest, (2) generating the phase profile of the desired optical element, (3) converting the phase profile into a metasurface GDSII layout, (4) fabrication. Modelling the meta-atom starts with the choice of the meta-atom, e.g., cylinder, cross, fin etc. Other experimental parameter to consider while choosing the shape is the polarization of the light that will be used to illuminate the metasurface. For example, the fin shaped meta-atoms works only for a circularly polarized light [25] whereas the cylinder and cross shaped meta-atoms work independently of the incident polarization [7,19]. After choosing an appropriate meta-atom, other geometric parameters of the meta-atom such as height, length, lattice periodicity need to be optimized. This task is generally carried out using a commercial FDTD solver such as Lumerical FDTD Solutions or CST FDTD Solver. Usually, these geometric parameters are much smaller compared to the operating wavelength. Conventional methods for obtaining meta-atom geometries involve large trial and error searches over candidate geometries. Usually, an initial rough simulation can be performed with approximate values for the geometric parameters of the meta-atom to obtain its transmission amplitude and phase. The next step in the design process is to vary one of the geometrical parameters over a range of values while keeping the remaining ones constant. The goal of this step is to obtain 0 -2π phase coverage with uniformly high transmission amplitude across this entire range. This step can be thought to provide us with a look-up table containing the meta-atom dimensions for the desired transmission phase. On conventional computer hardware, this step is the most challenging and time-consuming part of the simulation, and this optimization usually requires several iterations to arrive at the final geometric parameters. Machine-learning solutions are already making their way into solving this problem [26][27][28], where models can predict the right geometrical parameters given a desired operational wavelength.
The next step is to convert the phase profile from an image format into a metasurface layout in GDSII format. The phase profiles are usually generated in PNG, JPG or BMP formats. Each pixel in one such image file represents a phase value, which practically can be arrived at by modulating the thickness of the material being used (eg., glass in the case of ROEs and DOEs). On the other hand, in a metasurface layout, each pixel will be a meta-atom or a group of meta-atoms composed of metal or dielectric materials. Therefore, the phase profiles need to be converted into metasurface GDSII layout by a one-to-one mapping of the pixels in the image file to a single (or group of) meta-atom(s), by using the look-up table obtained from the FDTD simulations as shown in Fig. 1. In other words, each pixel in the image is represented by a single (or group of) meta-atom that gives the desired transmission phase at the corresponding location in the GDSII layout. Finally, this layout file is used to fabricate the metasurface using standard nanofabrication tools. As an example, the conversion from a blazed phase grating to 4-level metasurface is illustrated in Fig. 1. Simple and small metasurface layouts that are created in image formats such as PNG or JPG can be converted into GDSII format using opensource software such as GDoeSII [29].

MetaOptics software description
MetaOptics (GUI) is developed by using the Tkinter library of Python 2.7. This software mainly uses gdsCAD, Scipy, Numpy modules of Python 2.7. However, the user does not need to install Python or any of the packages mentioned above as MetaOptics comes as a single executable (.exe), file which can be directly executed on Windows-based computers. This executable file will not work on MAC based computers. However, the source code of MetaOptics can be executed after installing Python and the packages mentioned above. In this section, we will outline the operation flow of the software to design the metasurface GDSII layout of a given phase profile.

Choosing a wavelength
To start the design, the first step is to choose the operating wavelength from the list of available options. The wavelength selection window is shown in Fig. 2(a), which contains the most commonly used wavelengths in the visible and infrared spectrum. The FDTD simulated transmission phase and corresponding dimensions of the meta-atoms for all these wavelengths are hard-coded into the software. MetaOptics uses simulation data that we have generated [7] or has been extracted from literature [6,25].
If the desired wavelength is not available in the list of options, it is possible to upload user-specific phase versus varying dimension data in excel format. This can be done by using the Upload my data button, which upon clicking will lead to another window, as shown in Fig. 2(b). In this window, the desired geometry can be selected from the drop-down menu. The geometries supported by MetaOptics are labelled and shown in Fig. 3. Other important design parameters such as the operating wavelength, period, and height, which are crucial while creating the GDS file needs to be entered carefully and only in nanometers. After entering all the necessary parameters, an excel file containing the varying dimensions in the first column and the transmission phase in the second column needs to be uploaded using the Import Data button. It should be noted that the dimensions (radius for cylinder and length for cross) must be in nanometers and the phase must be within 0 to 360 degrees. In the case of fin geometry, the varying dimension would be the fin orientation angle about the x-axis and must be in degrees. If there is no error in any of the steps above, the software will display a message "Data uploaded successfully" at the bottom of the window and the Next button should be pressed to move on to the next stage of the design process.

Transmission phase vs varying dimension data
In this window, the interpolated plot of the varying dimension versus transmission phase data will be shown. If the user has selected the wavelength from the list of available options, they can obtain other essential parameters such as height, the material of the resonator which are necessary to fabricate the metasurface in this window as shown in Fig. 4. If the user chooses to upload his own data, careful attention must be paid to the plot as the same plot will be used in creating the GDSII layout. If the user is not satisfied with the interpolation fit, it is recommended to use more data points in the excel sheet and retry this step until the best fit is achieved. We recommend using at least 10 points to get a reasonably good fit.

Importing/generating a phase mask
The phase profile that needs to be converted into a metasurface layout can be uploaded in this window using the Upload phase button, as shown in Fig. 5. Several design parameters(labeled in Fig. 5) that need to be selected in this window are explained below.
(a) Unitcells per pixel: Number of n × n unitcells in GDS layout, per pixel in the phase mask.
This setting directly effects the phase resolution, the area of the final GDSII layout, and the output file-size. The effect of this setting on resolution is illustrated in Fig. 6.   (e) Apply circular aperture: Check this box if you want to crop your phase mask to a circle and create a circular metasurface GDSII layout.
The number of pixels (N) in a phase mask required to create a metasurface with length L, meta-atom period Λ, and n × n meta-atoms per pixel is given by, In addition to the above options, we have also included a handy library of optical elements such as Fresnel zone lens, axicon, and spiral phase profiles. The phase profiles of these elements can be generated by clicking the Generate button after entering the design parameters of those optical elements. When using library functions, it should be noted that, whenever the user changes the Unitcells per pixel setting, they must regenerate the phase profile by clicking the Generate button.

GDSII conversion
In this final step, all the design data is summarized for final verification, as shown in Fig. 7. Upon verification, the GDSII generation process can be initiated by clicking the Generate GDS button. This button click will pop up a window for the user to chose a location and a file name for the output GDSII file. Another convenient feature in MetaOptics is that, if the user is not satisfied with the design or made a mistake in any of the previous steps, she/he can quickly navigate back to previous design  step by clicking the Previous button. The user only needs to change the design parameter that she/he wants to modify while the rest of the settings are stored intact by the software. However, the Start New button can be used at any stage to start the design process all over again, with this all the previous settings will be cleared to defaults.

Output file-size and limitations
The file-size of metasurface GDSII layouts are typically large due to the large number of meta-atoms present in them. For example, a 1 × 1 mm 2 metasurface with a meta-atom periodicity of 250 nm will have 16 million meta-atom elements in its GDS layout. The image file of the phase mask of such metasurface should have 4000 × 4000 pixels when using 1 × 1 Unitcells per pixel (using Eq. (1)). The typical file-size of such GDS layout would range from few hundred of megabytes to few gigabytes, which can be extremely difficult to load into lithography systems. To reduce such large file-sizes, we have incorporated some techniques. One such technique is referencing the elements while creating the GDS layout. In this technique, in the 1 × 1 mm 2 metasurface mentioned earlier with m number of phase levels, all the 16 million meta-atom elements are a subset of the m differently sized meta-atoms that correspond to the m phase levels. Hence, we can create only the m different sized meta-atoms that correspond to the m phase levels and reference the 16 million meta-atom elements to one of these m meta-atoms. To avoid computer memory failures, we have limited the maximum number of elements while creating a layout to be 1 million. However, the python source code can be edited to increase this limit to any extent based on the computing power available to the user.
The file-size can also be reduced significantly by carefully using the Unitcells per pixel setting. For example, in the above example, by choosing 4 × 4 unitcells per pixel, the number of pixels in the phase mask can be reduced to 1000 ×1000 (using Eq. (1)). Such a layout would only have 1 million 4 ×4 grouped array of meta-atom elements, and this reduces the file-size 16 times, as the memory required a by single meta-atom and array of n × n identical meta-atoms is almost same. However, this results in the loss of some phase resolution as depicted in Fig. 6. Hence, the user needs to make a trade-off between the GDS file-size and the minimum possible resolution required.

Illustrative examples: fabrication and characterisation of large metasurfaces
In this section, we have shown the experimental results of all-dielectric metasurfaces that were designed with MetaOptics for a Bessel beam [30,31] and an LG beam [32,33]. The metasurface is fabricated using a quartz substrate, which has a 280 nm silicon layer deposited on top of it. Cylinder geometry is used as the meta-atom with a height, periodicity of 280 nm and 250 nm respectively. The radius of the cylinder is varied from 40 nm to 90 nm to achieve 0 -2π phase coverage, as shown in Fig. 1(a). The designed metasurfaces were fabricated using standard CMOS processing techniques involving electron beam lithography (EBL) followed by lift-off and reactive ion etching (RIE). The process flow is summarized in Fig. 8.

LG beam generation
We have generated the LG beams [32,33] (ℓ = 3) by using the technique of a fork hologram [34]. The different fork holograms (for creating LG beams of varying charge) were created by interfering a spiral phase profile with a plane wave. The resultant phase profiles were uploaded into MetaOptics to generate the desired metasurface layout for fabrication. In order to show the high efficiency of metasurfaces, when compared to binary DOEs, we have designed and fabricated three fork metasurfaces with 2, 4, and 8 levels and compared their relative efficiencies. The diameter of all the fork gratings is 1 mm.
The microscope images of the metasurfaces are shown in the top row Fig. 9(a), zoomed-in versions highlighting the number of levels are shown in the middle row of Fig. 9(b). An SEM image of a single pixel (4×4 unitcells) is shown in the inset of the first image of the second row  Fig. 9(b). In order to compare their efficiencies, the three devices were illuminated using the same laser source with its intensity kept constant. The designed metasurface works independently of the incident lights polarization [19]. The intensity profiles of the LG beams for the three devices were captured using a CCD camera and shown in Fig. 9(c). We did an interference experiment to confirm that the generated beams were indeed LG beams, the characteristic fork interference pattern is shown in Fig. 9(d).

Bessel beam generation
We generated a Bessel beam by using an 8-level meta axicon [35]. The phase profile of an axicon with cone angle α = 1.5 o , and a diameter of 1 mm is generated using the in-built library functions of MetaOptics. The spatial phase transmittance function of the axicon is calculated by using the analytical expression, where R is the radius, α is the angle, and n is the refractive index of the axicon. The theoretical Depth of Focus (DOF) of this axicon is 17 mm. This phase profile was converted to an 8 level metasurface with 4 × 4 unitcells per pixel. The output GDS file-size was 36 Mb. The microscope image of the meta-axicon is shown in Fig. 10(a). The intensity profile of the generated Bessel beam was captured at around the middle point of the DOF region. The transverse intensity profile and the 1D intensity profile along its center are shown in Figs. 10(b) and 10(c) respectively.

Impact
The applications of Metasurfaces are growing rapidly due to their high efficiency, compact size, and ease of fabrication. We believe MetaOptics can significantly reduce the design time of optical elements and enable researchers and engineers to design and fabricate high efficiency and multi-functional optical elements. Furthermore, MetaOptics acts as a higher level of abstraction in the design process and relieves the designer from spending a significant amount of time studying the underlying physics and simulation of metasurfaces. The GDS layouts generated by MetaOptics can be directly used with standard lithography tools during fabrication.

Conclusions
We developed an open-source software called MetaOptics. The user need not spend a substantial amount of time on learning how to perform FDTD simulations or gaining in-depth knowledge of metasurfaces. Future upgrade plans include the integration of an opensoure electromagnetic solve such as S4 [36] to perform simple FDTD simulations within MetaOptics itself, and finding ways to increase the current limit on the number of pixels in the input phase mask to more than 1 million elements.
With this project, we aim to bring a simple and intuitive platform to design metasurface GDS layouts, accessible to a wide range of researchers, teachers and students, including those not previously familiar with metasurfaces or lacking background in programming languages. We see MetaOptics as a fast, efficient and flexible tool that is developed according to the principles of open source to suit increasingly diverse uses in optics and nanophotonics applications.