In this example, we demonstrate the design and optimization of a polarization-dependent focusing lens. The primary applications of these polarization dependent lenses lie in polarization multiplexed imaging and 3D imaging, remote sensing and microscopy, polarization-controlled beam steering, and advanced display technologies. Metalenses can be engineered to exhibit polarization dependent behavior. To model this class of polarization sensitive lenses, we employ a workflow that combines full wave electromagnetic simulations in Lumerical with ray optical analysis in Zemax OpticStudio, following an approach similar to the Large Scale Metalens–Ray Propagation framework.
NOTE: This feature is only available in Ansys Zemax OpticSudio 2026R1.1 metalens DLL or newer. For the generation of the LSWM (see also lswmexport - Script command ) and LMAP (see also lmapexport - Script command – Ansys Optics) files, Ansys Lumerical of version 2026R1.1 or higher is required. Multi-wavelength is supported only from version 2025R1 or higher of the plugin.
Overview
Understand the simulation workflow and key results
Metalenses consist of subwavelength meta‑atoms, each positioned and engineered to impart a specific phase shift to the incident wavefront, thereby enabling precise wavefront shaping and focusing. Polarization‑dependent focusing metalenses rely on the same principle, with the added condition that the meta‑atoms must be asymmetric to produce distinct phase responses for different polarization states. In our design, we employ rectangular meta‑atoms with independently tunable dimensions along the X and Y axes to achieve this polarization‑selective behavior. This is achieved by defining an initial phase target for the S‑ and P‑polarized states (derived from an analytical expression) and comparing it to the phase ultimately produced by the meta‑atoms.
Step 1 Target phase definition – Zemax OpticStudio
In the first step we are setting up the metalens design using Zemax OpticStudio, for a lens diameter of 200 μm. This has two different configurations aimed at focusing on the same image plane but decentered on y axis by +/-50 μm, from the surface vertex, respectively (representing the different focus locations of the S and P polarization states). The phase of the metalens is modelled with the “us_binary_mix12_231020.dll”. The surface parameters are optimized separately in each configuration to phases profiles necessary for the 2 foci.
Step 2 Unit cell simulations in RCWA – Lumerical
Next, we design a library of unit cells using Lumerical. To make the unit cells polarization-sensitive, we use a rectangular meta-atom and sweep the variable dimensions in X and Y. We calculate the transmission and phase for each unit cell, under a range of illumination conditions (wavelength, polarization, and incident angle), using Lumerical RCWA. We export this library of unit cells along with the complex amplitude and phase response data to a file (LSWM). We then use a Lumerical script (LSF) to export a map (LMAP) that specifies the spatial position of each meta-atom across the metalens required to achieve the target phase profile.
Step 3 Integration in Zemax OpticStudio
In the final step, the complex amplitude and phase response (LSWM) and the meta-atom map (LMAP) files are imported into the same Zemax OpticStudio design established in the first step. A comparison between the first step (target phase) and this step of the ray-tracing behavior is performed by looking at the spot diagrams and the Geometric MTF of the four configurations.
Run and Results
Instructions for running the model and discussion of key results
Step 1: Target phase definition – Zemax OpticStudio
- Open the Metalens_phase_target_optimzation.zprj file in OpticStudio
In this step we are designing the polarization – dependent focus metalens in Zemax OpticStudio. The metalens consists of two surfaces and a material with specified refractive index (1.46), on the second surface the “us_binary_mix12_231020.dll” is used to optimize for a phase profile which can focus the incident collimated beam. The system is optimized for a target wavelength of 550 nm.
- Observe the multiconfiguration editor (check the CBDY and the PRAM variables)
We are using the multi-configuration editor to decenter the image plane for the two configurations using the CBDY operand for ±50μm respectively. The optimization of the phase profiles is achieved by varying the R2n and XnYm coefficients (A, B respectively), while the full analytical equation is shown below:
This equation is designed with flexibility to cover a range of analytically described target phase profiles. Most target phase profiles will fall into two categories:
- Hyperboloid: If we specify a target focal length (focus) and leave all other coefficients at zero, then we recover the standard hyperboloid phase profile. This will create a metalens that focuses the target wavelength at the specified focal distance.
-
General Polynomial: Alternatively, we can optimize a phase profile in
Zemax
defined by the coefficients in the summation terms; these include radially
symmetric terms A r ^2n and off-axis terms B x^n y^m. If this option
is
used (as it is in this example), the focus parameter should be left at
zero.
The overall focusing behavior, in this case, will be determined by the
coefficients
on A r^2n. The optimized coefficients from Zemax are copied into the
Lumerical
script.
In both cases, ref_wave corresponds to the primary wavelength in Zemax, which is 550 nm in this example.
- Optimize the design
The merit function is set up using the default operands for Spot optimization with the addition of using the REAY operand that defines the y-coordinates of the rays for each configuration. The four coefficients (two for each configuration) that are calculated after the optimization are provided to the next step. This can be achieved by applying the local optimization feature using the Damped Least Squares (DLS) algorithm, from which the r^2 and X0Y1 coefficients are obtained. This completes the optimization of the target phase profiles that we aim to realize. In the next steps, we will construct a metalens and then import that design back into Zemax to analyze how well we are able to achieve these phase targets with a realistic physical design.
Step 2: Unit cell simulations in RCWA – Lumerical
In this step, we build a library of unit cells. For this polarization-sensitive metalens, we aim to generate a library of unit cells that can simultaneously achieve the target phases for both S and P polarizations.
The unit cell geometry is defined using the “model” setup script. The unit
cell
is parameterized by its periodicity, height, x- and y- dimension of the rectangular
cross section, and optionally an overall rotation of the unit cell as well.
In
this example, we hold the height and period constant while varying the x
and
y dimensions.
The unit cell library contains results over a sweep of illumination conditions
on unit cell geometry. The illumination conditions (including propagation
direction,
angle of incidence, and wavelengths) are swept under the RCWA solver settings,
while the x and y dimensions of the unit cell are swept using the Parameter
Sweep
tool. Specifically, there is a nested sweep to sweep over the y dimension
from
50 nm to 400 nm for each setting of x-dimension, also ranging from 50 nm
to 400
nm.
- Open the unit cell base RCWA simulation, rect_cell_xy.fsp and inspect the settings.
The unit cell geometry is defined in the “model” setup script. In the “Excitation” tab of the RCWA solver settings, set the range of incident angles (theta and phi) and wavelength range to cover the desired range of illumination conditions.
In order to export the RCWA data to LSWM, there are a few important settings in the RCWA solver object. On the General tab, ensure the propagation direction is set to “both” and in the Results tab ensure the “report grating characterization” option is checked. This ensures that all the data required for the DLL in Zemax to determine the behavior of the light near the unit cell is included. In this example, the metalens is demonstrated at normal incidence so we consider a small range of incident angles theta and phi; increase the angular and wavelength range as needed to suit the illumination conditions in your Zemax model. The DLL in Zemax will use the closest available wavelength or angle in the event that analysis at Zemax is requested for an angle or wavelength that is not covered by the RCWA simulations.
- On the “Optimizations and Sweeps” tab, run “sweep_size_xy”. Note this is a nested sweep; use the small arrow to the left to display the child sweep.
The sweep records the grating_characterization result from the RCWA solver;
for
more information on the quantities defined, see
RCWA Solver - Simulation Object – Ansys Optics
. The results returned are of the form (R,T)(s,p)(s,p), where the (R,T) indicates
whether the grating orders are on the transmitted or reflected side of the
structure.
The first (s,p) indicates the source polarization while the second (s,p)
indicates
the outgoing polarization, for each grating order.
After running the sweep, you can export the LSWM file by right-clicking on
the
sweep name as shown in the screenshot below. Below the options to run the
sweep
and load results, find the “Export to LSWM” option to export the sweep results
to LSWM. During this step, the “interpolate over incident angle” and “interpolate
over wavelength” options must both be left unchecked as these are not supported
by the DLL in Zemax. The “Truncate order” may optionally be used to omit
unused
grating orders and reduce the size of the exported file. Additionally, the
Polarization
interpolation basis must be “SP.” Alternatively to locating this option in
the
GUI, you can also export the sweep data by script using
lswmexport - Script command – Ansys Optics
. In this example, we use the script command export the LSWM file as part
of
the script run in the next step.
The LSWM file contains the grating_characterization results for all the unit cells in the library, for both forward and backward direction.
In the next step, we generate an LMAP file which indicates the spatial arrangement of unit cells. That is, the LSWM file contains the physical characterization for each unit cell, while the LMAP file tells which of those unit cells goes where in order to build up a metalens.
- Open the script ‘lmap_metalens.lsf’ and enter the desired names of your LSWM and LMAP files in the first section.
This first section will retrieve the results from your unit cell sweeps and configure the important settings for lswmexport - Script command – Ansys Optics. If you have a previously saved LSWM file that you would like to use for the mapping, you can skip this section and just enter the name of your LSWM file in the final line of the script.
- In the next section of the script, enter the metalens diameter (200 μm), target wavelength, and optimized coefficients from Zemax (Step 1). More details about the metalens parameter specifications are given below.
- In the last line for the lmapexport command, enter the name of your previously exported LSWM file if necessary. Run the script to export the results
When used for metalenses, the lmapexport - Script command – Ansys Optics
command
accepts as input parameters the name of the unit cell library (LSWM file)
and
data structures describing overall metalens size and target phase profile.
For
metalens_size, enter the total width (diameter) of your metalens. You can
also
optionally adjust the centering from the default at (0,0) if you wish to
have
the phase profile offset.
The lmapexport script command uses the same general phase equation as defined
earlier, which can implement symmetric and non-symmetric phase profiles.
To match
the target phase designed in the Zemax model, we copy the optimized coefficients
from Zemax (these are the parameters in Zemax labeled r^2, r^4, r^6 etc for
the
symmetric terms and X0Y1, X0Y2, X0Y3, etc for the non-symmetric terms in
“us_binary_mix12_231020.dll”).
These coefficients are entered as a list, with one set of coefficients
for each targeted polarization. In the Lumerical script, “ref_wave_1”
and
“ref_wave_2” refer to the “ref_wave” in the equation, for the first
and
second polarization, respectively. This is typically the primary wavelength
in
Zemax.
Step 3: Integration in Zemax OpticStudio
- Transfer the .LSWM and .LMAP files to the folder …\Documents\Zemax\DLL\Surfaces
- Open the file Metalens_Step3.zprj
- Make sure that the Surface type of surface 4 is User Defined, using the Data File ‘lumerical-metalens-2026R1-1.dll, or a newer version
- Write the names of the files as a comment on the surface. Syntax: lswm_filename:lmap_filename (without the extension)
In this step, we import the LSWM and LMAP data into the initial Zemax design. We have created two new configurations (configuration 3 and 4) for this purpose. We use the lumerical-metalens-2026R1-1 DLL or newer version, and for Zemax to correctly read the data, we must place the LSWM and LMAP files in the appropriate folder, specify the file names in the Comment field of the DLL (User Defined) surface. Parameters 11, 12, and 13 of the ‘lumerical-metalens-2026R1-1.dll surface define the input polarization Jones vector components Ax, Ay, and Pxy (in degrees), respectively. The corresponding Jones vector is given by
Examples of commonly used polarizations are listed below:
Linear polarization (0° / 90°): [1,0], [0,1]
Linear polarization (±45°): [1,1], [1,−1]
Circular polarization (right / left): \( [ 1,\; 1\,e^{i\,90^\circ} ],\; [
1,\;
1\,e^{-i\,90^\circ} ] \)
The ray tracing behavior should be consistent with the targets defined for the two configurations described in Step 1 (configurations 1 and 2). The first and third configurations correspond to the focused beams for s‑polarization, obtained when ray tracing uses the Zemax‑optimized phase profile (step 1) and the actual phase profile generated by Lumerical (step 2), respectively. Similarly, the second and fourth configurations correspond to the focused beams for p-polarized light. The spot diagrams of the first and third configurations were compared, and the results are consistent with expectations. Similarly, the second and fourth configurations exhibit closely matching spot diagrams. Further analysis compares the geometric MTF for the same configuration pairs, and the results are also comparable. The left image shows the MTF diagrams of the first and the third configurations, while the right image shows the MTF diagrams of the second and the fourth configurations.
Important Model Settings
Description of important objects and settings used in this model
- During the “Export to LSWM” step, it is critical to NOT use interpolation in wavelength; this is not supported by the DLL in Zemax. If analysis in Zemax is requested at a wavelength not explicitly covered by the RCWA simulations, data from the nearest available wavelength will be used.
- It is not critical, but to reduce unnecessary data in the LSWM file we export only the 0th order result from RCWA by using the “Truncate order” option during the “export to LSWM” operation. Other orders will not be used.
- It is important to match the substrate material of the metalens object in Zemax with the refractive index of the substrate used in the RCWA simulation.
- For most of the analysis tools that do not consider polarization, such as the Layout/ Spot diagram and MTF, the polarization information is provided through the DLL’s parameters Ax, Ay, and Pxy. For some other analysis tools, such as Polarization Pupil Map, that supports polarization definition by providing settings Jx, Jy, X-Phase, Y-Phase or Use Polarization, DLL’s parameters are not used in calculation. In case of the analysis contains option of Use Polarization, the polarization information is provided in System Explorer > Polarization.
Taking the Model Further
Information and tips for users that want to further customize the model
- In this example, we demonstrate a polarization-sensitive metalens considering only linear polarization. Nevertheless, designs based on circularly polarized input can also be realized. The key requirement is the use of an appropriate meta-atom database for the selected polarization state, ensuring that the mapping optimization process can yield a viable and accurate solution.
- Full metalenses can be simulated in FDTD (see Small- Scale Metalens – Field Propagation – Ansys Optics for an example). Large metalenses will require HPC resources; for large simulations on-demand, consider GPU acceleration or Ansys Cloud Burst Compute™ for Lumerical FDTD – Ansys Optics
Additional Resources
Investigating OpticStudio’s polarization features
Related Ansys Innovation Courses
Appendix
Additional background information and theory
Windowed Fourier Transform with Polarization support
Using the implementation of Jones vectors, the meta-atom responses can be collected using an incoming ray with a particular polarization. The WFT is performed separately for the S and P components of the Jones vector representing the output ray. The direction is determined by using the combined far field information from the S and P responses.
This extension is straightforward as long as the full Jones matrix response of the meta-atoms is included in the transfer file used to upload the metalens information into the ray-tracing software. Previously, only the Tss component was included, which corresponds to the transmission factor from an S-polarized input into the S-component of the output light.