In this article, we briefly introduced design processes for diffractive optical element (DOE) and metalens using OpticStudio. The concept of phase profile and local grating is discussed. Some useful DLLs to support special DOE or metalens design method are also provided in attachment.
Authored By Michael Cheng
In this article, design processes for diffractive optical element (DOE) and metalens are discussed. The main goal is to provide designers, new to this topic, a starting point to see what methods are available in OpticStudio.
Simulating and designing for systems including DOE/metalens are always tricky. There is no generalized method to handle all situations. Designers need to decide the strategy for their systems case by case. Many design processes require two different optical theory/algorithms to separately handle the beam propagation in free space and in microstructure [1-3], while others use only pure ray-tracing to achieve the goal. 
In this article we start with a brief introduction of some possible design routes. More details are discussed later for concept of phase profile and propagation methods in free space and DOE/metalens. In the last section, some useful DLLs customized for special phase profile design are introduced.
Since the simulation technology develops fast, it is possible this article does not cover all the methods available. If users provide new information or have any requests, please feel free to reach out to us and we can update this article accordingly.
1. Design process
In this section, some well-known design processes are briefly discussed. Reference and examples are provided if available.
1.1 Phase profile -> microstructure -> experimental verification
In this process, users first design the required phase profile for DOE/metalens with ray-tracing method. Then the microstructure is designed based on the given phase profile. Figure 1 shows a flow chart for the process. This chart does not cover the details of the design, for example, the microstructure can be traditional blaze grating or modern metalens. The required design and fabrication methods can be very different depending on the types of microstructures.
Reference  shows an example of generating blaze grating from given phase profile. It also discusses the fabrication with single-point diamond turning machine. The macro to generate the blaze grating can be found in our Knowledgebase article How to calculate the sag of a diffractive optical element with a macro. The example system shown in Figure 1 can be found in attached “phase profile example.zar”. Alternatively, reference  shows how to design metalens for a given phase profile using Lumerical FDTD software.
The disadvantage of this method is that designers may not be able to check the performance of the whole system. For example, there is no way to check the real point spread function (PSF) considering all diffraction orders. Similarly, although rays from “non-working” order can be traced, there is no diffraction efficiency computed, therefore no way to know the power ratio in stray light paths.
Figure 1 A possible workflow to design DOE/metalens in OpticStudio.
1.2 Phase profile -> microstructure -> verify with POP+FDTD
To address the disadvantage of the previous process, where the system performance cannot be simulated before fabrication, Physical Optics Propagation (POP) together with FDTD can be used to accurately calculate the PSF. This method is mainly used by flat metalens designer. Zemax OpticStudio does not include FDTD engine, however, reference  shows an example of integrating Lumerical FDTD and Zemax OpticStudio for this process. Figure 2 highlights the concept of this process.
When the system only contains a single metalens, designers can directly start with a plane wavefront incident on the metalens in Lumerical FDTD. The electric field output after the metalens is exported as a ZBF file, which is further imported in OpticStudio POP for evaluating final PSF.
When the metalens, however, is placed in between lenses and the incident beam is not a plane wavefront, designers could start the simulation with a plane wave in POP. The beam is propagated in POP to the front of the metalens and exported as ZBF file. Then the ZBF is imported into FDTD as a source and being propagated through the metalens. The rest of the process remains the same as previously discussed.
One disadvantage of this process is that the FDTD engine cannot handle lenses of large dimensions, due to the need of intensive computation resources. Also, this method can only simulate PSFs at each individual field. Analyses like Image Simulation or Relative Illumination are not possible.
Figure 2 An enhanced version of the workflow shown in Figure 1. Before fabrication, designers could use POP and FDTD to check the final PSF.
Note: Currently we are looking at the possibility of using RCWA to accurately calculate diffraction efficiency for DOEs. This ideally allows users to keep using ray-tracing engine while still be able to analyze the whole system performance as well as perform image simulation and stray light analysis. This could solve the limitations that POP+FDTD don’t handle large scale DOE lens. Contact email@example.com if one is interested to test the prototype.
1.3 Parameterize DOE’s sag -> ray-tracing with FFT/Huygens PSF
Instead of using phase profile to represent DOE, it’s also possible to directly model the detailed blazed sag in Sequential mode and design the DOE with traditional ray-tracing engine and analyses like FFT and Huygens PSF. This method only works when the DOE’s feature size is not too close to the wavelength scale, where vector diffraction effect is strong. For this reason, this method is not suitable for metalens. A good example is discussed in reference , where the DOE sag is described by an equation that generates blazed structure similar to a Fresnel lens.
In addition to the limitation of feature size, another disadvantage of this method is that designers may still need to customize some tools to enhance the functionalities provided by OpticStudio. For example, currently there is no native sequential surface supporting the blazed sag as described in reference . Users need to create their own sequential surface DLL to model the unique surface sag. Also, currently OpticStudio does not support showing cross section PSF on, for example, Y-Z plane. A macro is required to scan PSF at different Z locations and create the plots as described in reference .
The following knowledge base articles are good starting points if users want to customize a sequential surface using DLL.
How to compile a User-Defined DLL
Custom DLLs in OpticStudio: An overview of user-defined surfaces, objects, and other DLL types
1.4 Parameterize DOE’s sag -> POP
Similar to the method described above, it is possible to simulate a Fresnel zone plate by modeling the binary-like sag in OpticStudio. However, for this type of DOE, ray-tracing engine will not work well. Rays perpendicularly incident on the DOE will not change its direction since there is no slope on the surface. However, in reality, the perpendicularly incident beam can be focused with adequately designed Fresnel zone plate. This effect should be handled by POP in OpticStudio.
An example file “Fresnel Zone Plate Phase Type.zar” of using POP for Fresnel zone plate is attached in this article for users’ reference. As shown in Figure 3, in this system a collimated beam is incident on a glass plate. At the back side of the glass plate, a concentric binary structure has been created using Fresnel Zone Plate surface type. In the Layout window, you can see rays do not change their propagation directions and the beam remains collimated propagating from Object to Image surface.
Note, with this kind of structure, the maximum allowed diameter of the lens may strictly depend on the degree of coherence of the incident beam and the lens focal length. Principles of designing zone plate lenses will not be discussed in this article.
Figure 3 Layout of a system with Fresnel Zone Plate.
However, if the same situation is now modeled using POP analysis, one will observe that the beam comes to focus on the image surface, as shown in Figure 4. Here, we start with a Gaussian beam of waist size 2.6 mm and focus the beam down into a spot of a waist size about 0.4 mm. This example shows that this type of structure can only be simulated using POP.
Figure 4 POP result on image plane for Fresnel Zone Plate.
Note that POP is based on scalar diffraction theory, so it is not suitable for metalens where the feature size is typically sub-wavelength.
2. Phase profile
Phase profile is a well-adopted design method for DOE. A big advantage is it can naturally work with ray-tracing engine, which takes advantage of most of the tools available in OpticStudio. The disadvantage is, after deploying microstructures from the given phase profile, we currently have not a way to consider diffraction efficiency natively in OpticStudio. Phase profile provides enough information for calculating where a ray is diffracted to. However, there is no information about how much power the diffract rays should contain. To report this power, we need other tools to calculate the diffraction efficiency.
Figure 5 shows an example of how a diffractive surface on intraocular lens diffracts rays into several orders. With phase profile, it’s easy to know the diffracted rays’ direction for each order. In Figure 3, rays from diffraction order -1 (Red), 0 (Blue), and +1 (Green) are drawn. Currently the diffraction efficiency for each diffraction order cannot be calculated. In other words, it is possible to know how the spots look like for each diffraction order, but the power distribution among these orders remains unknown.
Using diffractive surfaces to model intraocular lenses
Figure 5 This is an example of diffractive ocular lens design. The diffractive surface is made by Binary 2 surface. Rays in layout are diffractive by DOE. Rays’ path for -1 (Red), 0 (Blue), and +1 (Green) orders are drawn. Note there are more possible orders which are not drawn.
In this section, the determination of phase profile, ray-tracing with phase profile, and how to derive microstructures are discussed.
2.1 Get the phase profile
The following equation for phase profile is commonly seen in many metalens papers.
However, this equation only works for small field of view (FOV). For large FOV, the best phase profile needs to compromise between several field angles and wavelengths. The following knowledge base articles give some good examples of using sequential surface Binary 2 to design the phase profile for DOE.
How diffractive surfaces are modeled in OpticStudio
Using diffractive surfaces to model intraocular lenses
Reference  has a section that also explains the same concept of designing phase profile in OpticStudio. Note the phase profile can also be asymmetric if its’ an off-axial design . In this case, sequential surface Binary 1 is usually a good choice, but other phase surfaces, such as Zernike Standard Phase are potentially also capable to use.
2.2 Phase profile and concept of local grating
The diffractive optics modeling is well described in this knowledge base article How diffractive surfaces are modeled in OpticStudio. However, in this section, a different viewpoint and concept of local grating are provided for users’ reference.
An important concept to know is the approximation of locally constant-period grating. As shown in left graph of Figure 6, when a ray is traced to a curved surface, it’s locally considered as a planar surface and Snell’s law is used to refract rays. In the right graph of Figure 6, a ray hits a period-varying grating on the curved surface. In this case, it’s also locally considered as a plane and the grating period is considered as constant. This “locally constant-period grating” approximation is a useful concept to help understand how a DOE represented by a phase profile can work with ray-tracing method.
Figure 6 Rays traced through a normal surface (left) and a DOE surface (right).
To trace a ray through surface described by a phase profile, the period of the local grating at arbitrary point on the DOE is first determined by taking derivative of the phase profile shown in the following equation.
Note the period calculated from above equation is the component projected on the xy-plane as shown in Figure 7. In the following picture, you can also see that the phase slope becomes larger as the period become smaller.
Figure 7 Local grating period and phase profile.
Once the grating period is determined from the phase profile, the following diffraction equation can then be used to calculate the diffracted ray’s direction.
By some vector operation, the solution of r2 can be written as below.
Once the phase profile is designed, the realistic microstructure can be further derived. There are two different but similar methods to build the microstructure from a phase profile.
In the world of metalens design, usually designers figure out the relationship between meta-atom’s shape and the phase it delays. The meta-atom is then deployed based on this relationship and the given phase profile. [1-3]
For some traditional DOE designs, the phase profile is considered as a frequency distribution function. In this way, the DOE can be seen as a concentric circular grating where the period is a function of radial distance. 
The two interpretations are roughly the same because both generate periodic structures with varying-period on the surface. The main difference is that the structure at each periodic zone is different. In Figure 8, it shows we can convert a phase to a blaze grating or meta-atoms. In general, metalens has more freedom and can achieve better efficiency or more functionalities, although at the mean time it also poses challenge to design and fabrication.
Figure 8 Concept that a grating can be fabricated as a traditional binary grating, a blaze grating or a metalens.
3. Some useful DLLs
Here some DLLs are provided to supplement the special surface types that are not supported natively in OpticStudio yet. These may be useful for some modern DOE or metalens design. Users can download them from the link in this article. The following sections briefly discuss how to use these DLLs.
This DLL’s function is a hybrid of native surface Binary 1 and Binary 2. It supports only planar surface. This is useful for off-axis metalens design. This DLL can be extracted by opening the attached Binary2_mix12_demo.zar.
Figure 9 Demonstration system layout from Binary2_mix12_demo.zar file.
This is the same as the native Binary 2 surface except it supports aspheric terms up to 30th order, instead of 16th order on the native Binary 2 surface. This is useful if users want to design DOE or metalens on high-order aspheric lenses. This DLL can be extracted by opening the attached test_asp30_bin30.zar.
This surface is similar to the native Binary 2 surface, but with some differences. It only supports flat surface and only has binary phase terms up to 10th order. This surface allows different phase profiles for different wavelengths. The parameters are named Wxry, where x is an integer for wavelength number and y is an integer for the order of the binary phase term number. This surface is useful if the metalens is designed to have different responses (phase profiles) for different wavelengths. Note it requires specific design to let metalens behaves differently for different wavelengths. Check with metalens designer before using this DLL.
Figure 10 Part of parameters of the us_binary2_metals.dll
In the article, 4 different design processes for DOE and metalenses are introduced and discussed. The concept of using phase profile to simulate diffractive optics is explained with details. We also provide 3 DLLs for user to download. These DLLs are customized for simulating special diffractive optics that are not currently supported by native OpticStudio surface types.
 Chen, W.T., Zhu, A.Y. & Capasso, F. Flat optics with dispersion-engineered metasurfaces. Nat Rev Mater 5, 604–620 (2020). https://doi.org/10.1038/s41578-020-0203-3
 Faraji-Dana, M., Arbabi, E., Arbabi, A. et al. Compact folded metasurface spectrometer. Nat Commun 9, 4196 (2018). https://doi.org/10.1038/s41467-018-06495-5
 Anna Nemes-Czopf, Dániel Bercsényi, and Gábor Erdei, "Simulation of relief-type diffractive lenses in ZEMAX using parametric modelling and scalar diffraction," Appl. Opt. 58, 8931-8942 (2019)
 RIEDL, Max J., “Diamond-turned diffractive optical elements for the infrared: suggestions for specification standardization and manufacturing remarks”, SPIE Vol 2540 / 257
Article is closed for comments.