How to calculate the sag of a diffractive optical element with a macro

This article explains how to calculate the sag of a diffractive optical element using a ZPL macro in OpticStudio.

Authored By Serhat Hasan Aslan, ASELSAN


Article Attachments


The macro attached to this article calculates the sag and phase data of a rotationally symmetric kinoform (Binary 2 surface) lens surface. User inputs include the surface number and radial step size. Outputs include the zone number, zone radius, inner radius sag, outer radius sag, and step height for the diffractive optic. Profile frequency (in waves/mm) (which can be used as a manufacturing difficulty merit) is also calculated.

Equations and definitions

The general form of the sag of a surface is calculated as follows1:




C  =  1/R, R: Radius

 =  conic constant

ρ  =  radial coordinate

A2,4,6,8…  =  aspheric coefficients

λ  =  wavelength

N  =  refraction index of lens

C2,4,6,8…  =  phase coefficients

Step height is given as:

Phase profile of a diffractive surface in radians is given as:

OpticStudio uses the normalized form of phase coefficients. The conversion of normalized form is given below, with R representing the normalized radius:

The typical diffractive profile is as follows:

Typical Diffractive Profile


To run the macro, download it and place it in your {Zemax}\Macros folder.

Open the system you want to analyze in OpticStudio and navigate to The Programming Tab…Macro List…DoeSag.zpl.

Once activated, the macro takes the surface number and radius iteration step size for sag calculations from the user, as shown below:

Input Surface Number 

Input Radius Step Size


The macro outputs zone number, zone radius, inner radius sag, outer radius sag, step height, and profile frequency (waves/mm) as shown below:

Output Table 1

This is followed by the calculated data for each radius incremented by the step size, as shown below:

Output Table 1

The macro plots the phase, integer part of phase, and phase modulo 1 wave as shown below:

Output Phase Plot

Finally, profile frequency in waves/mm is plotted and frequencies corresponding to zone radius are crossed as shown below:

Output Frequency Plot


1. RIEDL, Max J., “Diamond-turned diffractive optical elements for the infrared: suggestions for specification standardization and manufacturing remarks”, SPIE Vol 2540 / 257


Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.